Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Kernel require #280

wants to merge 607 commits into from

Sorry. I need to figure out how to indicate that I just want a couple of lines changed. Hold on.

In jruby, the autoload mechanism doesn't actually call Kernel.require like the rubydocs claims it will. This change attempts to fix that.


autoload(module, filename) → nil click to toggle source

Registers filename to be loaded (using Kernel::require) the first time that module (which may be a String or a symbol) is accessed in the namespace of mod.

Note that this change uses the context when autoload is called rather than the context at the time when the require will happen. I wasn't sure what the right thing to do is, or how much it really matters or not.

The purpose of this change is to allow the user to override Kernel.require even with autoloading. rubygems is presmably the most well-known overrider of Kernel.require. It presumably ends up pulling in enough stuff into LOAD_PATH via direct requires that any autoloading it does still works, but I suspect it could be problematic if it tried to add paths for autoloaded files.

Also, my apologies that this commit has an old parent (it's whatever rvm was using).

Thanks for your consideration,


headius and others added some commits
@headius headius Fix JRUBY-6212: IO#inspect in 1.9 could be prettier
(cherry picked from commit b7c3cc2)
@headius headius Fix for OpenJDK 7 and popen from 8798e1f 24f4592
@headius headius Fix JRUBY-6205: 'Bad file descriptor' when using IO.popen4 with OpenJ…
…DK 7

* Same fix as for popen some months ago. See 8798e1f
(cherry picked from commit 3adbb9e)


@headius headius Don't attempt to track lines that are <= 0, since they're probably in…
@headius headius Fix JRUBY-6201: File reading performance regression
Oddly enough, the regression here was in Module#name for anonymous
classes. For JRUBY-6030, anonymous classes that later gain a parent
namespace were fixed to recalculate their new name. However, the
change also made anonymous classes never cache their names. It turns
out that the way those names were being calculated was rather
expensive, and as a result a hidden perf issue surfaced.

For 1.6.x, I've modified the anonymous name calculation to cache,
since it never changes (it is based on identity hash code). I also
made an optimization pass on the normal non-anonymous class name
calculation, since master (1.7) no longer caches either name.
@headius headius Fix JRUBY-6198: When calling dup on file open in binmode the new obje…
…ct does not respect binmode

* binmode was propagated as a mode, but not as a flag on the underlying Stream.
(cherry picked from commit ed560a8)
@headius headius Fix JRUBY-6192: jruby::Handle declarations use 'extern "C"', causing …
…linker symbol mismatches
@donv donv * JRUBY-6172 Test
Signed-off-by: Hiro Asari <>
@donv donv * JRUBY-6172 Avoid using getCanonicalPath to expand JAR entry paths
Signed-off-by: Hiro Asari <>
@nahi nahi JRUBY-6208: GzipWriter creates corrupted gzip stream for binary data
default_external for GzipWriter IO stream is not specified by default.
@nahi nahi [1.9] Make Encoding.default_external = enc work
default_internal, too.
@BanzaiMan BanzaiMan In 1.9, BigDecimal#div raises FloatDomainError if self or argument is…
… a NaN.
@BanzaiMan BanzaiMan In 1.9, BigDecimal#div(INFINITY) returns 0 80b341c
@BanzaiMan BanzaiMan In 1.9, throw ZeroDivisionError if arg for BigDecimal#div is 0 and no…
… precision is given.
@BanzaiMan BanzaiMan In 1.9, BigDecimal("Infinity").div BigDecimal("1") raise FloatDomainE…
@eregon eregon Struct#members and Struct::members should return an Array of Symbols …
…in 1.9

Signed-off-by: Hiro Asari <>
@BanzaiMan BanzaiMan In 1.9, Hash#merge! checks frozen-ness earlier than checking the argu…
…ment's emptiness.
@BanzaiMan BanzaiMan Fix BigDecimal#divmod in the 1.9 mode, according to RubySpec. da8a68c
@BanzaiMan BanzaiMan Add bin/rake to jar-complete. Fixes JRUBY-6233. e27686b
@BanzaiMan BanzaiMan Fix Array#* spec, where taintedness does not propagate to the return …
…value if arg = 0.
@BanzaiMan BanzaiMan Fix Fixnum#quo spec, where arg is a Bignum. fca0b1b
@BanzaiMan BanzaiMan In 1.9 mode, allow permutations larger than the number of elements in…
… the set.
@enebo enebo JRUBY-6120: Incorrect behavior of RubyMatchData updateCharOffset() an…
…d Strings with special characters
@enebo enebo Revert asm back to 3.3 on 1.6 branch deab67d
@headius headius Fix ASM reference in IntelliJ project. 2d9b189
@headius headius Fix JITed class names in backtraces. 5ecde60
@headius headius Repair damage from e0ee1ec.
I reversed the evaluation order of "colon2" assignment to ensure the
value evaluates first, but failed to remove "swap" operations
elsewhere that expected the RuntimeHelpers.setConstantInModule
method to take the LHS, RHS ordering. Fixed those locations and
added a test.
@headius headius Add target java version to compile-test target. D'oh! 0542fc8
@headius headius Make rake-based calls to java have permgen up to 512M. 74da27a
@headius headius Add install-gems as a dep of test-all, since it needs the dev gems. 8458cad
@headius headius A new implementation of ThreadFiber that passes specs.
The raw LockSupport use I had before was fast, but I did not deal
with the fact that any fiber could end up waking any thread,
regardless of whether that thread was waiting on the fiber. By
switching to Exchanger, a given fiber can only wake the thread
that is actually waiting on it.

This may not be as fast as the other impl, but works properly. I
will reinvestigate performance.


@headius headius Add RandomAccess to RubyArray implements. a69f064
@headius headius Remove unnecessary "this" printing from ThreadFiber exceptions. 00aa52c
@yokolet yokolet Fix for JRUBY-6229. Adds get/setProfilingMode methods. This correspon…
…ds to --profile.api/--profile.flat/--profile.graph command line options
@yokolet yokolet Adds setProfilingMode method to RubyInstanceConfig so that ScriptingC…
…ontainer user can change profile mode.
@BanzaiMan BanzaiMan Fix JRUBY-6237: Allow the syntax `a = b = f 1`
This was introduced with MRI 1.9.3.
@enebo enebo 1.9: when *[], false no longer explodes f497f26
@headius headius Fix JRUBY-6272: Encoding exception running JRuby 1.6.5 (1.8 mode)
Don't use cat19 for Hash#inspect in 1.8 mode.
@yokolet yokolet Possible fix for JRuby-6110. 6cc12dc
@yokolet yokolet Avoids NPE from ScriptingContainer.terminate() method and adds termin…
…ate tests for LocalContextProviders.
@headius headius Update JRuby versions to, since that's what we're working on. 7805966
@klauern klauern Windows won't move the `.jar.bak` file back to the `.jar` as there's …
…a file there, so forcing it works when tearing down.
@enebo enebo Do not test symlink on windows 0d7103e
@nicksieger nicksieger Get Windows build clean again 56dfda4
@klauern klauern fix test for windows line terminating chars `\r\n`. 011927b
@klauern klauern"") doesn't return the right error on WinXP. f129a92
@nicksieger nicksieger Missed import of JRubyNonExistentFile 4bfd298
@klauern klauern fix test/test_file#test_file_uri_stat on WinXP
The if statement should be broken down into two parts so an else clause
can throw an exception for file not found errors as it does throughout the
rest of the method.

Fixes the following test failures on WinXP:

  2) Failure:
test_file_stat_uri_prefixes(TestFile) [.\test\test_file.rb:556]:
[Errno::ENOENT] exception expected, not
Class: <SystemCallError>
Message: <"Unknown error - Unknown Error (20047) - C:/klauer-jruby/file:">
org/jruby/ `lstat'
.\test\test_file.rb:557:in `test_file_stat_uri_prefixes'

  3) Failure:
test_file_time_uri_prefixes(TestFile) [.\test\test_file.rb:573]:
[Errno::ENOENT] exception expected, not
Class: <SystemCallError>
Message: <"Unknown error - Unknown Error (20047) - C:/klauer-jruby/file:">
org/jruby/ `atime'
.\test\test_file.rb:574:in `test_file_time_uri_prefixes'
@headius headius Update to JRuby fork of RubyGems 1.8.12. 59c1509
@grimradical grimradical Comparing a RubyFileStat object with an object which is not a RubyFil…
…eStat should return 'nil'.

Otherwise, we get a ClassCastException when we attempt to cast "other" to a RubyFileStat.
@enebo enebo Placeholder for next upcoming version of jnr-posix for 1.6.6 until it…
… is really released
@headius headius Add coro-mock jar to eliminate java.dyn package in our repo. bc8ece7
@headius headius Remove java.dyn classes. 8a4efc7
@headius headius Update to RubyGems 1.8.13 (JRuby fork). 76bcfdc
@BanzaiMan BanzaiMan Invert the priority for setting the default directory for Dir.chdir w…
…hen directory is not given. This partially addresses JRUBY-6295. (This commit corresponds to 5dfa654 on master.)
@headius headius Reinstate 1.9 logic in compiler for splatting nil.

@headius headius Proper fix for DRegexp and mixed encodings in 1.9 mode.

@headius headius Additional tweaks and fixes for dregexp fix from master.
* Tom's code-range scanning line
* Missing imports
* Wrong param type in RuntimeCache for Bignum method
@enebo enebo Allow proper 1.9 splatting for interpreter (JIT to come) ef43a18
@enebo enebo Fixes to_ary behavior of 1.9 in interp only 3e25b55
@headius headius Fix JRUBY-6171: Enumerable does not splat
Turned out it was simpler than I thought...1.9 splats a bit differently,
and we weren't calling that path.
@nahi nahi [1.9] One-off fix for read_nonblock CPU 100% issue
Replace "read_nonblock + timeout" in 1.9 stdlib with
"Timeout.timeout + sysread" in 1.8's one.  With current JRuby,[io], nil, nil, timeout) could return promptly even if io is
not readable. (I'm not sure the condition when it happens at this

Because of this behavior, rbuf_fill in 1.9/net/protocol.rb
fails to busy loop of io.read_nonblock and  As a workaround,
this commit replaces rbuf_fill of 1.9 stdlib with 1.8's one which uses
Timeout + sysread instead.

sysread_nonblock + is introduced from perf concern.  JRuby has
a better Timeout logic so this change should not affect users.

I apply this change only for jruby-1_6 branch.  For 1.7, I'll try to
solve this issue by fixing nonblocking IO at master.
@enebo enebo No pipe on windows to test 0ebdad2
@headius headius Partial fix for JRUBY-6200: [1.9] Loading some Unicode characters res…
…ults in non-printable characters on Windows

The InputStreamReader we wrapped around the "IO like" object did not
specify an encoding. For now, we force UTF-8, since that likely
covers 99.9% of all YAML out there, and fixes the original reported
@headius headius Lost import of RubyEncoding somehow. b924cef
@nahi nahi [SECURITY] Random String#hash to avoid DoS attack
This is the fix for CVE-2011-4838.

Randomize String#hash (in Ruby world) and internal RubyString#hashCode()
(in Java world) for 'Denial of Service via Algorithmic Complexity
Attacks' explained in [1].  Introduce the runtime-local seed for hash
randomization which is set at runtime initialization and use it as the
seed for MurmurHash 2.0 [2].  MurmurHash is used in CRuby 1.9 and it
should make the attacks difficult. (Assuming that no reverse function
has been found for MurmurHash 2.0)

Credit to Alexander Klink <> and
Julian Waelde <> for reporting
this issue.

@BanzaiMan BanzaiMan Fix JRUBY-6307. Under some circumstances, the test "xz /x != z" can g…
…ive a wrong result because x*x overflows the "long" range and the overflow ends up in just the right spot. We fix this problem by introducing BigInteger here. This is a tiny performance hit; if there is a better way while retaining correctness, I would be curious to learn the trick.
@BanzaiMan BanzaiMan spec for JRUBY-6307. I do not know if it is really a regression, but …
…I will put the spec here.
@nahi nahi Hide hash value test which expects deterministic hash value 2fc3a13
@headius headius Add .idea files so we can switch to/from jruby-1_6 without warnings. 87c7bed
@lstoldt lstoldt Move 'to_i' so it gets picked up by DefaultTypePopulator
Signed-off-by: Hiro Asari <>
@BanzaiMan BanzaiMan In the eyes of RubyGems, equate YAML::Yecht with Syck, so that Defaul…
…tKey in Dependency resolves to "=". This fixes the issue described in
@headius headius Update to latest 1.9.2 stdlib. be3f90f
@headius headius Update 1.9.2 stdlib list to not copy thread.rb. e06dc50
@headius headius Update patchlevel and revision for 1.9.2 support. 7b34774
@headius headius Set English.rb aliases immediately, and make it a no-op.
Because we rely on the presence of $~ and $_ global variables to
know we must allocate space for them, we need to define their
English.rb aliases right away and disallow further aliasing. Since
we must define those aliases, we might as well define all aliases
and make English.rb a no-op.
@headius headius Add missing global alias $MATCH from English.rb. 3a83bb7
@headius headius Update to latest 1.8.7 stdlib. 29bae86
@headius headius Update 1.8.7 patchlevel. ef36279
@headius headius Fix JRUBY-6284: Calls to Kernel#exit result in an exception printed o…
…n stderr

Allow SystemExit propagated to an embedded container's "run" or "eval"
call to simply make the script return the exit's status.
@headius headius Fix JRUBY-6281: [1.9] Applet does not work in the 1.9 mode
For 1.9 mode we canonicalize loaded paths to make sure we are not
double-loading files that are required in different ways, and so we
can properly use per-file locking around requires. However, in a
restricted environment we may not be able to canonicalize. My fix
falls back on just using the literal require name in such cases.

I also split the test-security-manager task into 1.8 and 1.9 versions.


@headius headius Fix JRUBY-6280: Fails to open fifo for writing.
It turns out that in glibc, fopen operations that would seek in
the resulting file descriptor do actually check for ESPIPE to know
that a failed seek is due to the file being a pipe or FIFO. We do
not have direct access to the actual ESPIPE, but we can check the
IOException message to know if it's the same problem.

I don't think there's any real risk in this change, since it will
only quietly fail to seek on a file when it's impossible to seek
on that file, which is what we want. Other error cases and open
failures should propagate as before.

@BanzaiMan BanzaiMan Fix Complex#coerce spec when other is a Complex. f83e347
@BanzaiMan BanzaiMan Fix Complex#rationalize spec. bdaf760
@yokolet yokolet Adds more predefined global variable names to avoid unexpected errors. 12f02ae
@headius headius Use JRuby's parent classloader rather than JRubyClassLoader for startup. 4dc6d33
@yokolet yokolet $ARGV and $* should not be readonly to meet with JSR223 spec. 80b7d22
@headius headius Update jnr-posix.jar to latest, for JRUBY-6286 patch. 6a85dd0
@larvacea larvacea JRUBY-3944: process :binmode option
The :binmode option, when set to TRUE, is ORed in with flags from the mode string or
:mode option, as it is in MRI 1.9.2. Tested in rubyspec; both MRI and this code pass
new tests for :binmode, and the existing jruby 1.6.5 code fails as expected.

Signed-off-by: Hiro Asari <>
@headius headius Refactor parsing of options for encodings and modes. 3233fcf
@BanzaiMan BanzaiMan Fix JRUBY-6318: Tempfile#open does not return the value of the block …
…given to it

This happens only for the 1.9 mode.
@headius headius 1.9 fixes for popen.
* Process modes and encodings into the resulting IO object
* Use the target class for the resulting IO object


@headius headius Refactor some process-launching logic into ProcessMaker. 729a4e1
@headius headius Fix bad reference to Tempfile, nonexistent on jruby-1_6. ed3d56d
@headius headius Fix JRUBY-6319: 'binding' returns wrong binding
instance_exec was not setting the binding's self along one path.
@headius headius Fix JRUBY-6324: `pollAndGetClass': java.lang.NullPointerException
The problem here was that srand's global seed was not initialized
at boot, resulting in the first call returning null. That null
propagated into Ruby execution, eventually blowing up in a call

My fix is to make an initial call to the srand logic, creating a
first seed.
@BanzaiMan BanzaiMan Fix JRUBY-5792: Eval error for hashes containing symbols ending with …
…an equals sign

Here, we remove the test for n which prevented us from matching MRI behavior of this corner case of the Ruby grammar.
@nahi nahi Update Eclipse build configuration
Add coro-mock jar.
@yokolet yokolet Additional fix for JRUBY-6110. 69c2b7b
@nahi nahi JRUBY-6324: random seed for srand is not initialized properly
jruby -e 'p srand' returns previous (initial) srand seed.  In 1.8 mode,
it always returns 0 but it's not correct.  In 1.9 mode, it crashes with
NullPointerException because it returns null as RubyObject.  Anyway,
initial seed value is not initialized properly.

This commit includes several fixes for Random.

* Initialize the runtime-local PRNG and seed at Ruby#initCore().

* Keep seed for PRNG as not long but RubyInteger.
  % jruby165 -e 'n = 2**128; srand(n); p [n.object_id, srand.object_id]'
  [2000, 1] => should be the same object

* Introduced Ruby#randomSeedRandom as the runtime-local PRNG for
  generating seed by srand.  Do not use System.currentTimeMillis which
  is not suited for PRNG seed.

* Removed globalRandom in RubyRandom class which is used only in 1.9
  mode.  Use Ruby#getRandom() for global srand as same as 1.8 mode.
BanzaiMan and others added some commits
@BanzaiMan BanzaiMan Bring tool/git_bisect_run* scripts up to date with the master branch 7c62c23
@headius headius Fix JRUBY-6384
Seems like either a bad merge or I deleted a line without noticing it.
@headius headius Fix JRUBY-6383
Scala integration breaks with 1.6.6

This has actually been "broken" since 1.6.0, since we were not
defining the symbolic names for any of the $ Scala methods. This
fix adds the symbolic names and leaves the originals intact.
@BanzaiMan BanzaiMan Fix JRUBY-6386: time.localtime not taking any arguments
Tests will go into RubySpec.
@BanzaiMan BanzaiMan Merge branch 'jruby-1_6' of into jruby-1_6 4a9e2aa
@BanzaiMan BanzaiMan Invert branching logic in RubyTime.localtime19() so that branches are…
… narrower in appearance.
@enebo enebo Get fallback external from IO if bom| present (note: bom still unimpl…
@BanzaiMan BanzaiMan Fix JRUBY-6344: Embedded \r should not be treated as end of comment line
Previously, we substituted '\r[^\n]' with '\n', to account for the Classic Mac OS's
newline character. This is year 2012. It seems highly unlikely that anyone would be running JRuby on that OS.
@BanzaiMan BanzaiMan The change corresponding to efa4931 for ByteArrayLexerSource. ff10454
@headius headius Fix JRUBY-6382
[1.9] Padrino can't generate an app

Looks like another tiny porting bug. Calls to joinAny need to
specify a start index based on the Array's "begin". Fixed for this
case and added an assert.
@enebo enebo Update to formal release of jnr-posix 1.1.9 (was temp build before - …
…no functional changes)
@enebo enebo Bump for 1.6.6 5673572
@BanzaiMan BanzaiMan Bumping compile memory. Java 7 u4 seems to run out of heap while comp…
…iling with only 256 MB.

Also bumped jruby.launch.memory and jruby.test.memory.

@nahi nahi Revert "Avoid circular require caused by rubygems/maven_gemify"
This reverts commit 409c61f.
See JRUBY-6400 and JRUBY-6407.


@nahi nahi Revert "Revert "Avoid circular require caused by rubygems/maven_gemify""
This reverts commit b3cf679.
See JRUBY-6407.  The correct fix follows.
@nahi nahi JRUBY-6400, 6407: Fix StackOverflowError under some Gem activation si…

RubyGems seems to expect that we don't invoke custom_require while Gem
spec scanning.  Our JRuby extension in rubygems/defaults/jruby did
'require "jruby/util"' while Gem scanning and it caused circular
custom_require invocation.

Since jruby/util is a small, non invasive library (it defines JRuby
module, JRuby::Util module and some methods of JRuby::Util), this commit
simply moved the 'require "jruby/util"' line at the top of
rubygems/defaults/jruby.rb for loading the library at RubyGems
initialization time.
@headius headius Update 1.9.2 stdlib to pick up URI lazy-init fix. f9c3604
@BanzaiMan BanzaiMan Attempt to fix JRUBY-6417. Here, we call "to_s" rather than "to_str" …
…on the key value in the option passed to IO.popen
@BanzaiMan BanzaiMan Bump version to 09e0e17
@BanzaiMan BanzaiMan Fix JRUBY-6398: java.lang.NullPointerException when executing jruby.exe
When JVM has an unusual default encoding, we fail to boot. Avoid this by falling back on ASCII-8BIT.
@dekellum dekellum Avoid warning: statement not reached SecureRandom
The runtime warning here was:

.../ruby/site_ruby/shared/securerandom.rb:61 warning: Statement not reached

and indeed there was a large block of unreachable code.

Signed-off-by: Hiroshi Nakamura <>
@tychobrailleur tychobrailleur Fix for JRUBY-6378
Signed-off-by: Tim Felgentreff <>
@enebo enebo JRUBY-6396: Fix strip! for single byte strings passed through mbc cod…
@lopex lopex fix coderange for 1.9 String#sub! eb67481
@enebo enebo JRUBY-6433: DRegexp with specific encodings were getting non-strict v…
…ersions in 1.9 mode
@enebo enebo JRUBY-6425: StringIO.readline of UTF-8 string will return a ASCII-8BIT d2af6e8
@BanzaiMan BanzaiMan Spec for JRUBY-6103: allocator undefined for NativeException
Marked pending for now.
@BanzaiMan BanzaiMan Fix JRUBY-6103: allocator undefined for NativeException by providing …
…a simple allocator for NativeException.
@headius headius Fix classpath: load path entries to properly do a classloader search.

@GregMefford GregMefford Resolves Major Bug in Win32OLE in 1.9 mode:… e1da925
@enebo enebo Work around non-existent types in ffi (yum win32ole works now) 4195a64
@yokolet yokolet The same fix as df0de38 in master. Removes path method for 1.9 since …
…path should not be respond_toable on 1.9.
Wayne Meissner Fix JRUBY-6193 by replacing usage of asprintf() with alloca(3)+snprin…


@headius headius Fix JRUBY-6399
wrong number of arguments (4 for 3) when calling enum_for in 1.9 mode

We were missing the varargs version of Enumerator#initialize in 1.9 mode.
@headius headius Remove unused block args. 423d68d
@headius headius Fix JRUBY-6291: Closing One Stream From IO.popen4 Results in Stream C…
…losed Error When Reading Other Streams

Ben figured this one out. The logic I put in place to ensure the
child process gets nuked for a popen stream was causing it to be
nuked prematurely for popen3/4 streams. I added a "popenSpecial"
boolean to RubyIO, so we know not to do that.
@bbrowning bbrowning Test for JRUBY-6291: Closing One Stream in IO.popen4 Breaks Reading O…
…ther Streams
@headius headius Fix JRUBY-6434
sprintf does not support name references, like sprintf('%<xyz>s', :xyz => 'abc')

* Added %<foo> support to Sprintf
* Moved %{foo} support from Ruby kernel to Sprintf, since it was
incorrectly matching %<foo> stuff (and was brittle anyway)


@headius headius Additional minor tweaks for JRUBY-6434
* Propagate format string's encoding into key names
* Eliminate useless Ruby-land sprintf def
* Eliminate deprecated call from RubyKernel.printf


@enebo enebo 19: dest string was not getting started with proper encoding and code…
@ryfow ryfow Might fix JRUBY-5165
Run finishConnect when selecting sockets for write.


@headius headius Additional tweak for JRUBY-5165
* Check isConnectionPending so we don't finishConnect incorrectly.
@headius headius Add backtrace.mask flag to mask .java lines in backtrace. 9f4d431
Wayne Meissner Revert "Work around non-existent types in ffi (yum win32ole works now)".
This reverts commit d18bbf7.
@enebo enebo Add proper values for ffi on 64-bit windows 12f26fe
@enebo enebo JRUBY-6404: multiple assignment fails to deconstruct object 21e02d1
@headius headius Remove unnecessary synchronization from RubyModule.calculateName. 6b5478d
@headius headius Fix locale-insensitive test in test_big_decimal. f7e6017
@headius headius Clear RUBYOPT and JRUBY_OPTS env for junit tests, to avoid interference.

@enebo enebo Keywords are not valid captures as regexp names c54ba87
Wayne Meissner Fix JRUBY-6438 by splatting the arrays before passing to the NotFound…
…Error constructor
@headius headius Additional fixes for JRUBY-6434
* Make sprintf pass hash through without wrapping in array
* Fix totally broken KeyError logic
* Handle %<foo><bar> ArgumentError like MRI
* Mask more logic behind is1_9 check
* Remove exclude for MRI TestSprintf#test_named



This commit duplicated this section of code - see line R4022 below.


This is the duplicate of line R4006. The original was removed in line L4047 below.


The original of the duplicated code.


You seem to have duplicated a section of code here. See inline comments.

In 1.6.6, this line fails: filename, File::Constants::CREAT | File::Constants::WRONLY, binmode: true

TypeError: can't convert Hash into Integer
    from org/jruby/ `initialize'
    from org/jruby/ `new'

I just found out that the "wb" mode would be exactly equivalent to File::Constants::CREAT | File::Constants::TRUNC | File::Constants::WRONLY, binmode: true anyway (I somehow missed the TRUNC, thus only overwriting beginnings of files on subsequent open/write cycles), and this is an acceptable workaround in my case.


I'd be happy to accept a patch/pull request for any additional cleanup you would like to suggest. This is an ongoing process targeting JRuby 1.7, and I want to finally put our IO/Socket logic in a happy place. I'd definitely like help.

enebo and others added some commits
@enebo enebo JRUBY-6416: JRuby 1.6.6(1.9-mode) freezing in Rails application witho…
…ut any error, when manipulating a String with special characters
@headius headius Fix JRUBY-6456
ThreadLocal Leak in 1.9 Mode w/ Internal Recursive Map

Our code was a direct port of MRI's, and they seem to have the
same issue: no logic clears out the threadlocal map once the
recursive walk is complete. I added an outermost method called
recursiveListOperation that should always be used to wrap the
execRecursive* calls.


@headius headius Additional tweaks for JRUBY-6456
* execRecursiveOuter is always outermost, so add finally logic there
* Add explicit check for recursiveListOperation in execRecursive


@headius headius Avoid calling "expensive" RubyModule.getName just for backtraces. e189467
@enebo enebo Be green damn you 2a40e35
@enebo enebo Be green damn you 0296e6b
@headius headius Port GzipReader commits from master for JRUBY-6415.
commit 773a155
Author: Charles Oliver Nutter <>
Date:   Mon Jan 9 02:40:33 2012 -0600

    Actually set new bytelists to external encoding in GzipReader.

commit 84e3e3f
Author: Hiroshi Nakamura <>
Date:   Wed Feb 1 13:37:00 2012 +0900

    Fix GzipReader encoding on 1.9 mode (produced encoding == null String)

    It's a fix for "-J-ea pointed out we were creating a bad ByteList with
    no encoding in 1.9 mode..." reported by Tom.

    The actual bug is from 1 line, that I forgot to set default
    externalEncoding to runtime.getDefaultExternalEncoding()
    But the problem is from name confusion.  Use proper names, readEncoding
    and writeEncoding for enc, enc2 in Ruby's IO subsystem.
@enebo enebo A CI job tries to use this obvious missing ant target 8581cf3
@enebo enebo ci uses this target from ant c26cb4f
@enebo enebo More undefined targets 3e9b769
@headius headius Partial fix for JRUBY-6442
TCPSocket#write_nonblock blocks

Only selectable Java channels can be set nonblocking, so this
patch only improves situations for selectable channels. Others
will still just do a blocking write, as before. This patch does at
least get sockets and other selectables to actually do write_nonblock
close to how it's supposed to be done.

Better fix will come with 1.7 IO refactoring, though the non-
selectable channels will still be an issue.
Wayne Meissner Fix JRUBY-6164. Problem was multiple cleaners on the same data object. 8905123
@headius headius Fix JRUBY-6238
Issues with eval - wrong arguments

module_exec with no args was allowing self to be passed as the sole argument.
@lopex lopex class_variable_get, class_variable_set, remove_class_variable are pub…
…lic in 1.9
@headius headius Fix typo in 1.9-mode class_variable_set binding. 9847379
@headius headius Fix bad expectation in that module_exec passes self.

@enebo enebo update pom and use release bytelist-1.0.10.jar b3f8727
@enebo enebo Whoops pom update to match new bytelist 43331ce
@enebo enebo Update to jcoding 1.0.7 48f2d25
@enebo enebo Update to joni 1.1.7 63ca88e
@enebo enebo Generic boxed version of squeeze! should still work with no-arg list c43ba85
@timfel timfel add explicit endianess format support to Pack util 8231346
@headius headius Damn the torpedos...merge master's zlib to 1.6.
Process followed:

* Refactor RubyZlib into ext.zlib package
* Copy ext.zlib package contents from master
* Copy jzlib from master
* Fix up project/build files
* Fix up imports and 1.6 encoding calls
* Move library from org.jruby.libraries to ext.zlib
* Fix up test_zlib.rb from master
* Fix up spec tags from master

Represents a couple dozen commits from master relating to zlib
fixes, jzlib integration, and encoding work.
@headius headius Use RuntimeMXBean rather than custom propertes for mem/stack errs. 2ce71d5
@enebo enebo JRUBY-6463:'foo').strip Leaves Trailing Newline Under 1.9 8879729
@headius headius Raise the WaitWritable version of EAGAIN for write_nonblock.

@headius headius Reduce contention and overhead in object_id allocation. a9e0ec1
Wayne Meissner Remove synchronization on getObjectIdAccessorForWrite() or getNativeH…
…andleAccessorForWrite(), and defer it to allocateObjectIdAccessor and allocateNativeHandleAccesor, to eliminate contention on the RubyClass in the optimal case where the VariableAccessor has already been allocated.
Wayne Meissner Add benchmark for multi-threaded 40079f1
@nahi nahi Refix JRUBY-6208: GzipWriter#write should honor writeEncoding, not re…

Title says all.  The regression spec I added before wrongly used
GzipReader#read() without size parameter.  GzipReader#read() uses the
specified read encoding (it is Encoding.default_external if not
specified) and it hides this bug.
@headius headius Fix JRUBY-928: Java arrays don't inherit from java.lang.Object in Rub…
…ified Java class hierarchy

* After JI has initialized, rewire ArrayJavaProxy superclass to be < (Enumerable) < java.lang.Object.


@ConradIrwin ConradIrwin Ignore Binding's line when file is passed to eval
Before this change eval("__LINE__", binding, "file") would return the
current line of the binding; after this change it will return 1.

Spec at jruby/rubyspec@88f3dff#L1R24

Signed-off-by: Charles Oliver Nutter <>
@lopex lopex holy shmoly, why ? 9f3f488
Wayne Meissner Regen x86_64-windows FFI types.conf 2d41d99
@enebo enebo Bump for 1.6.7 3e82bc8

On my machine with 1G of RAM, this commit means I can no longer compile jruby. Switching jruby.launch.memory back to 512M fixes the issue. There is no justification in the commit message for bumping jruby.launch.memory, and jruby builds fine with a value of 512M, so it might be better to revert that part, unless 1G is actually required on some java versions (I'm using 1.7.0b147 on OpenBSD, as that is the latest version in ports).


I'm rather disappointed that compiling jruby base now takes this much memory in Java 8's javac, but that was the reason for this change. I'll poke around and see if I can find any way we can reduce memory use during compile.

@ashanbrown ashanbrown closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.