-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Issue in org.jruby.util.TypeConverter CheckType #2924
Labels
Milestone
Comments
Reproduction in Ruby: runtime = JRuby.runtime
context = runtime.current_context
opts = {foo: 'bar'}
org.jruby.util.TypeConverter.check_type(context, opts, runtime.hash) |
Chamila: I think you're probably right. Only one place in JRuby is using this method, so it must be stale or perhaps it never worked properly at all. You should compare our version with MRI's version and make them match in a PR. |
MRI implementation
|
cdwijayarathna
added a commit
to cdwijayarathna/jruby
that referenced
this issue
May 11, 2015
cdwijayarathna
added a commit
to cdwijayarathna/jruby
that referenced
this issue
May 14, 2015
cdwijayarathna
added a commit
to cdwijayarathna/jruby
that referenced
this issue
May 14, 2015
Closed
headius
added a commit
that referenced
this issue
May 19, 2015
Fixed by #2930. Thanks, @cdwijayarathna! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to use above mentioned method to check it a IRubyObject is a RubyHash or not,
Following is how I used it.
TypeConverter.checkType(context, opts, context.runtime.getHash());
When I give a Hash as opts, my irb interface I get following output.
TypeError: wrong argument type Hash (expected Hash)
I'm sure that here it should be "Wrong arguement type ",
because in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/util/TypeConverter.java#L300 it has used the reference class to (RubyModule t) to identify the type of the object ('x').So I believe #L300 should be x.someMethod(), not t.someMethod().
Other issue is, when I pass a Hash, to this it gives this TypeError. I think the issue is in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/util/TypeConverter.java#L299,
x.getMetaClass().getNativeClassIndex() refers to "CLASS" while t.getClassIndex() refers to "HASH".
I tried with other types as well and I didn't get true when types match at any time.
The text was updated successfully, but these errors were encountered: