Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6-beta-2
-
None
-
None
Description
Two equal instances of an @Immutable class should produce the same value when used as a map key. This is not the case, even though their hash codes are equal.
The last assert below fails, though it should succeed.
@Immutable final class Foo { String bar } foo1 = new Foo('bar') foo2 = new Foo('bar') assert foo1 == foo2 assert foo1.hashCode() == foo2.hashCode() fooMap = [(foo1) : 1] assert fooMap[foo1] == 1 assert fooMap[foo2] == 1 // Fails!!!