-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* jruby-1_7: add declaring class methods for Java/Ruby on JavaConstructor make the java method spec pass on Ruby > 1.9 (method names are symbols) move and add some more Java 8 interface specs use (Java 6+) compiler API instead of `javac` (to make sure right is used) increase return type on internal method re-use some code snippets within instance and meta java_send impls move JavaProxyClassMethods from Java into JavaProxy instead spec TypeError raised with java_send when there's a type mismatch spec how Java array[].to_s behaves on non-byte[] move byte[] proxy to_s into a specialized class avoid e.printStackTrace + init native ex.cause and cleanup RubyDigest some make require 'digest/bubblebabble' work (MRI compatibility) Fix Digest bubblebabble incorrect output on empty string Remove several layers on copying in babblebubble. Add direct BubbleBabble power from OpenSSH manually filter out matching callables with non-matching arguments length Conflicts: core/src/main/java/org/jruby/ext/digest/RubyDigest.java core/src/main/java/org/jruby/javasupport/Java.java
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
- 9.0.4.0
- 9.0.3.0
- 9.0.1.0
Showing
11 changed files
with
351 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'digest' # bubblebabble gets in with Digest ext loading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
require File.dirname(__FILE__) + "/../spec_helper" | ||
|
||
describe "an interface (Java 8+)" do | ||
|
||
before :all do | ||
require 'tmpdir'; @tmpdir = Dir.mktmpdir | ||
files = [] | ||
|
||
src = <<-JAVA | ||
public interface Java8Interface { | ||
static String message() { return "hello"; } | ||
static String message(CharSequence name) { return "hello " + name; } | ||
abstract String bar() ; | ||
default CharSequence foo(Object prefix) { return prefix + "foo" + ' ' + bar(); } | ||
} | ||
JAVA | ||
files << (file = "#{@tmpdir}/Java8Interface.java"); File.open(file, 'w') { |f| f.print(src) } | ||
|
||
src = <<-JAVA | ||
public class Java8Implemtor implements Java8Interface { | ||
public String bar() { return getClass().getSimpleName(); } | ||
} | ||
JAVA | ||
files << (file = "#{@tmpdir}/Java8Implemtor.java"); File.open(file, 'w') { |f| f.print(src) } | ||
|
||
fail "#{files.inspect} compilation failed (see above javac output)!" unless javac_compile files | ||
|
||
$CLASSPATH << @tmpdir | ||
end | ||
|
||
after :all do | ||
FileUtils.rm_rf @tmpdir | ||
end | ||
|
||
it "binds static methods on the proxy module" do | ||
expect(Java::Java8Interface.message).to eq("hello") | ||
end | ||
|
||
it "exposes static methods via java_send" do | ||
expect(Java::Java8Interface.java_send(:message)).to eq("hello") | ||
end | ||
|
||
it "exposes static methods via java_send with type" do | ||
expect(Java::Java8Interface.java_send(:message, [java.lang.CharSequence], 'world')).to eq("hello world") | ||
end | ||
|
||
it "exposes static methods via java_method" do | ||
expect(Java::Java8Interface.java_method(:message).call).to eq("hello") | ||
end | ||
|
||
it "exposes instance method via java_method" do | ||
method = Java::Java8Interface.java_method(:foo, [ java.lang.Object ]) | ||
expect(method.name).to eq(:"foo(java.lang.Object)") # default | ||
method = Java::Java8Interface.java_method(:bar) | ||
expect(method.name).to eq(:"bar()") # abstract | ||
end if RUBY_VERSION > '1.9' | ||
|
||
it "(default) java_method is callable" do | ||
method = Java::Java8Interface.java_method(:foo, [ java.lang.Object ]) | ||
expect( method.bind(Java::Java8Implemtor.new).call '' ).to eql 'foo Java8Implemtor' | ||
end | ||
|
||
it "java_send works on impl (default method)" do | ||
impl = Java::Java8Implemtor.new | ||
expect(impl.java_send(:bar)).to eq("Java8Implemtor") | ||
expect(impl.java_send(:foo, [ java.lang.Object ], 11)).to eq("11foo Java8Implemtor") | ||
end | ||
|
||
def javac_compile(files) | ||
compiler = javax.tools.ToolProvider.getSystemJavaCompiler | ||
fmanager = compiler.getStandardFileManager(nil, nil, nil) | ||
diagnostics = nil | ||
units = fmanager.getJavaFileObjectsFromStrings( files.map { |fname| fname.to_s } ) | ||
compilation_task = compiler.getTask(nil, fmanager, diagnostics, nil, nil, units) | ||
compilation_task.call # returns boolean | ||
end | ||
|
||
end if ENV_JAVA['java.specification.version'] >= '1.8' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters