Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* JRUBY-6875 JRuby should load some_path/some_file.jar.rb if some_pat…

…h/some_file.jar is required and some_path/some_file.jar does not exist.

* Added '.jar.rb' to the suffixes that should be tried for extensions
  • Loading branch information...
commit b37a0bd7e05955eecc9a6b60651df81cde78c58e 1 parent 13057bc
@donv donv authored
View
3  src/org/jruby/runtime/load/LoadService.java
@@ -167,7 +167,7 @@
private static final String[] allSuffixes;
static { // compute based on platform
- extensionSuffixes = new String[2];
+ extensionSuffixes = new String[3];
extensionSuffixes[0] = ".jar";
if (Platform.IS_WINDOWS) {
extensionSuffixes[1] = ".dll";
@@ -176,6 +176,7 @@
} else {
extensionSuffixes[1] = ".so";
}
+ extensionSuffixes[2] = ".jar.rb";
allSuffixes = new String[sourceSuffixes.length + extensionSuffixes.length];
System.arraycopy(sourceSuffixes, 0, allSuffixes, 0, sourceSuffixes.length);
System.arraycopy(extensionSuffixes, 0, allSuffixes, sourceSuffixes.length, extensionSuffixes.length);
View
0  test/fake.jar.rb
No changes.
View
4 test/test_load.rb
@@ -185,6 +185,10 @@ def test_require_with_non_existent_jar_3
$:.shift
end
+ def test_load_rb_if_jar_doesnt_exist
+ require 'test/fake.jar' # test/fake.jar does not exist, but test/fake.jar.rb does.
+ end
+
def test_overriding_require_shouldnt_cause_problems
eval(<<DEPS, binding, "deps")
class ::Object
Please sign in to comment.
Something went wrong with that request. Please try again.