jruby can't use it's own java classes #1925

Closed
guai opened this Issue Aug 27, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@guai

guai commented Aug 27, 2014

jruby 1.7.13

require 'jruby'
JRuby.runtime.defineReadonlyVariable('$var', proxied_java_object, Java::org.jruby.internal.runtime.GlobalVariable::Scope::GLOBAL)

This does not work. JRuby always tries to unwrap proxied_java_object to the core object even when IRubyObject is needed by itself.
It seems ConcreteJavaProxy#toJava should also check this condition:

else if(type.isAssignableFrom(getClass())) {
            return this;
        }
@Lan5432

This comment has been minimized.

Show comment
Hide comment
@Lan5432

Lan5432 Mar 28, 2016

Contributor

Excuse me, but what's "proxied_java_object" supposed to be?

Contributor

Lan5432 commented Mar 28, 2016

Excuse me, but what's "proxied_java_object" supposed to be?

@guai

This comment has been minimized.

Show comment
Hide comment
@guai

guai Mar 29, 2016

It's the jruby's proxy object which wraps some java object. proxied_java_object implements IRubyObject.
And It can't be passed to method which expects IRubyObject param, because jruby first tries to unwrap the target java object out of it and pass it as argument.

guai commented Mar 29, 2016

It's the jruby's proxy object which wraps some java object. proxied_java_object implements IRubyObject.
And It can't be passed to method which expects IRubyObject param, because jruby first tries to unwrap the target java object out of it and pass it as argument.

@kares kares added this to the JRuby 9.1.0.0 milestone Apr 6, 2016

@kares kares self-assigned this Apr 6, 2016

kares added a commit that referenced this issue Apr 6, 2016

@kares kares closed this Apr 6, 2016

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