Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.7
-
Fix Version/s: JRuby 1.7.0.pre2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
require 'java'
5==java.lang.Integer.new(5) returns true on Macs but nil on linux. I tried this on several different versions of JRuby up to and including 1.6.7.
On the RHEL install and any macs the following returned true
5.0 == java.lang.Double.new(5)
5 == java.lang.Long.new(5)
The fact that only Integer has this issue makes me think its some sort of bug related to JRuby on on Redhat. Id' be willing to try other things or do more investigation but right now I'm not sure how to proceed.
I would be more inclined to pin this on JVM differences. Sometimes JDK classes will add a new method that takes a primitive, and we'll start picking that one up.
In this case, at least for fixnums, == will flip it around and call == on java.lang.Integer, which will call the Java equals(Object) and should coerce the fixnum to a java.lang.Long.
On master/1.7 this actually leads to a ClassCastException:
On 1.6.7 I see "true" result as you do (on Mac) for all cases, on both Java 6 and Java 7.
I just happen to have a fedora VM here, so I'll give it a shot. Can you tell me what version of Java you tried with?