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

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

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

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

guai opened this issue Aug 27, 2014 · 2 comments
Assignees
Milestone

Comments

@guai
Copy link

@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
Copy link
Contributor

@Lan5432 Lan5432 commented Mar 28, 2016

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

@guai
Copy link
Author

@guai 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.