Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invocation of become_java! instances fails with "cannot make variable arity" #3206

Closed
rtyler opened this issue Aug 1, 2015 · 0 comments · Fixed by #3779
Closed

Invocation of become_java! instances fails with "cannot make variable arity" #3206

rtyler opened this issue Aug 1, 2015 · 0 comments · Fixed by #3779

Comments

@rtyler
Copy link

rtyler commented Aug 1, 2015

When experimenting with passing objects for invocation back and forth into Nashorn, I wrote the following code:

class Example
  java_signature "java.lang.String hello()"
  def hello
    return 'hello world from Ruby'
  end
end

ex = Example.become_java!.new
# pass `ex` into Nashorn

From the JavaScript, which uses reflection for invocation, I invoked this #hello raises this error:

MemberName.java:852:in `makeAccessException': java.lang.IllegalAccessException: cannot make variable arity: rubyobj.Example.hello()String/invokeVirtual

@headius wrote this patch which, when compiled and tested, properly allows the invocation of this JRuby-originating instantiated Java class

rtyler pushed a commit to rtyler/jruby that referenced this issue Aug 6, 2015
…Java

This is effectively a patch written by @headius and tested locally and applied
by me. In my use-case this allows Java code to properly reflect back into a
Ruby-generated Class and invoke a method which takes no arguments.

Fixes jruby#3206
kares pushed a commit to kares/jruby that referenced this issue Jan 10, 2016
…Java

This is effectively a patch written by @headius and tested locally and applied
by me. In my use-case this allows Java code to properly reflect back into a
Ruby-generated Class and invoke a method which takes no arguments.

Fixes jruby#3206
kares added a commit that referenced this issue Apr 4, 2016
…ing) signatures

previously all method arities ended up as var-args : `foo(IRubyObject[] args)`

now for fixed arities we'll have correct number of args e.g. `foo(IRubyObject arg1)`
... we still generate var-args: `foo(IRubyObject[] args)` for all non-fixed arity sizes!

resolves #3206 and likely #449 also #3366 (java_signature is now honored)
kares added a commit that referenced this issue Apr 6, 2016
…ing) signatures

previously all method arities ended up as var-args : `foo(IRubyObject[] args)`

now for fixed arities we'll have correct number of args e.g. `foo(IRubyObject arg1)`
... we still generate var-args: `foo(IRubyObject[] args)` for all non-fixed arity sizes!

resolves #3206 and likely #449 also #3366 (java_signature is now honored)
@kares kares added this to the JRuby 9.1.0.0 milestone Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants