Issue Details (XML | Word | Printable)

Key: JRUBY-971
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Charles Oliver Nutter
Reporter: Charles Oliver Nutter
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

Make it clear which Java method maps to each equality method

Created: 21/May/07 04:51 PM   Updated: 23/Apr/08 10:04 AM
Component/s: None
Affects Version/s: None
Fix Version/s: JRuby 1.1b1

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide
There's some confusion about which Java methods should be redefined/rebound for each of the equality methods. For example, RubyKernel defines ==, eql?, and equal? all to map to obj_equal, and === maps to equal. However Fixnum maps == to an overridden implementation of equal, which calls super.equal. This is incorrect behavior. We need to ensure that all the equality methods map to the correct Java methods, and that we're overriding the right ones in every case.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Thomas E Enebo added a comment - 21/May/07 06:10 PM
Marcin's comparison script shows a few differences:
missing Method: Symbol#===
missing Method: Proc#==
missing Method: Module#==
extra Method: Time#===
extra Method: Symbol#==

Marcin Mielzynski added a comment - 22/May/07 08:00 AM
Fixnum#== maps to overridden implementation of equal (fix_equal equivalent) which by super.equal(...) calls RubyNumeric.equal(...) (MRI num_equal equivalent) - this is correct.

Kernel#==, Kernel#eql?, Kernel#equal? all map to MRI rb_obj_equal
Kernel#=== maps MRI to rb_equal which in turn just calls "==" method

since Kernel#eql? semantics is used by hashes, only Kernel#== and Kernel#equal? can be considered the same (and these should actually map into java's equals method - if they don't do so yet...).

I'll tackle the remaining equality methods posted by Tom.


Charles Oliver Nutter added a comment - 22/May/07 01:38 PM
With the patch in JRUBY-540, we get to a point where a fix is needed from this bug.

Charles Oliver Nutter added a comment - 31/May/07 04:27 AM
This is largely refactoring, and doesn't appear to have a direct effect on any user apps or code. So it's getting punted to post 1.0.

Marcin Mielzynski added a comment - 31/May/07 05:04 AM
Part of this has been done with JRUBY-540, there's no problem to make it a separate work (though it would make JRUBY-540 patch stale)

Charles Oliver Nutter added a comment - 31/May/07 01:30 PM
I'm not concerned about the JRUBY-540 patching becoming stale if we can get fixes in that make == and friends more correct...but it would definitely need to be reviewed to include it in 1.0...

Charles Oliver Nutter added a comment - 30/Sep/07 10:58 AM
I think most of this may have been done already as part of Marcin's recent refactorings. Assigning to Marcin to weigh in on whether we need this bug open anymore.

Charles Oliver Nutter added a comment - 08/Oct/07 01:24 PM
Fixed remaining naming issues on trunk. The convention is now as follows:
== maps to Java method op_equal
=== maps to Java method op_eqq
eql? maps to Java method eql_p
equal? maps to Java method equal_p