Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Java classes with signatures should be reified #623

Merged
merged 4 commits into from

3 participants

@daicoden

It's possible that this actually isn't broken and I'm using the API improperly. I had to put the following change into a patch to use a java_signature that took a parameter.

Let me know!

docs/README.test
@@ -44,3 +44,9 @@ 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 use the checked in bin/rspec executable
@BanzaiMan Owner

This is incorrect. bin/rspec will be generated when rspec gem is installed by install-dev-gems ant target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@BanzaiMan
Owner

Hello. I updated the summary to reflect the intention of the pull request more accurately.

@headius headius was assigned
@daicoden

Thanks BanzaiMan, fixed!

@headius
Owner

Looks good, merging!

@headius headius merged commit d4e50ba into from
@headius
Owner

FYI, I updated the readme to a more direct ant target for compiling tests: ant compile-test

@daicoden daicoden deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 2, 2013
  1. @daicoden
  2. @daicoden

    Better fix.

    daicoden authored
  3. @daicoden

    Update testing doc.

    daicoden authored
  4. @daicoden

    Correct readme.

    daicoden authored
This page is out of date. Refresh to see the latest.
View
5 docs/README.test
@@ -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`
View
9 lib/ruby/shared/jruby/compiler/java_signature.rb
@@ -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
@@ -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
View
33 spec/java_integration/reify/java_signature_spec.rb
@@ -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
Something went wrong with that request. Please try again.