Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/README.test
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ A slightly shorter run we run frequently is:
ant spec-short

The rubyspecs will be fetched over the net, and then executed.

To run an individual test:
run `ant install-dev-gems` which will install bin/rspec for use.
run `ant test` to compile the java fixtures (you don't need to wait for the tests to finish)
then test as normal with `bin/rspec spec/path-to-spec`
9 changes: 7 additions & 2 deletions lib/ruby/shared/jruby/compiler/java_signature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ def as_java_type(string)
type = primitive? string
return type if type

if string.is_a?(Java::OrgJrubyAstJava_signature::ReferenceTypeNode)
return eval make_class_jiable(string.getFullyTypedName())
end

# If annotation makes it in strip @ before we try and match it.
string = string[1..-1] if string.start_with? '@'

eval "Java::#{make_class_jiable(string)}"
eval make_class_jiable(string)
end


##
# return live JI proxy for return type
def return_type
Expand Down Expand Up @@ -116,7 +121,7 @@ def make_class_jiable(string)
last_cap = false
end
end
new_list.join("")[1..-1]
"Java::#{new_list.join("")[1..-1]}"
end
end
end
33 changes: 33 additions & 0 deletions spec/java_integration/reify/java_signature_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require File.dirname(__FILE__) + "/../spec_helper"
require 'jruby/core_ext'

describe "JRuby class reification with signatures" do
subject { cls.become_java! }

context "method signatures" do
let(:cls) do
_signature = signature
Class.new do
java_signature _signature
def run(*args)
end
end
end

let(:signature) { "public void run()"}

it "successfully reifies" do
expect { subject }.to_not raise_exception
expect { cls.new.run }.to_not raise_exception
end

context "with arguments" do
let(:signature) { "public void run(java.lang.String)" }

it "successfully reifies" do
expect { subject }.to_not raise_exception
expect { cls.new.run("bar") }.to_not raise_exception
end
end
end
end