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

Unable to merge java hash with ruby hash #5258

Closed
pranavbansod opened this issue Jul 23, 2018 · 2 comments
Closed

Unable to merge java hash with ruby hash #5258

pranavbansod opened this issue Jul 23, 2018 · 2 comments

Comments

@pranavbansod
Copy link

Environment

Provide at least:

  • JRuby version: 9.2.0.0 jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.171-b11 on 1.8.0_171-b11 +jit [darwin-x86_64]
  • Operating system and platform: Darwin inpranavb.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64

Expected Behavior

With the JRuby/Java interop, I'd expect that it should be possible to merge a java java.util.HashMap object with a ruby Hash object. Esp because the java.util.HashMap seems to implement a merge method.

Actual Behavior

$ java -jar jruby-complete-9.2.0.0.jar -e 'java.util.HashMap.new.merge({})'

ArgumentError: wrong number of arguments (1 for 3)
  <main> at -e:1
@kares
Copy link
Member

kares commented Jul 23, 2018

a won't fix - with JI its always Java methods first. here there's a collision with java.util.Map's merge
... which did not exist until Java 8, however JRuby provides a work-around by setting up conflicting methods with a ruby_ prefix, thus: java.util.HashMap.new.ruby_merge({}) ... works as expected

@kares kares added this to the Won't Fix milestone Jul 23, 2018
@headius
Copy link
Member

headius commented Aug 16, 2018

Yeah I agree with @kares here...we always have to be able to access the Java methods. Perhaps we need to document this better?

@headius headius closed this as completed Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants