-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
24
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Lets have a record "Data(Long primaryKey, Details details)" and two instances of it, "a" and "b".
The expected behaviour when calling "a.equals(b)" would be that the for records automatically generated code would test "a.primaryKey.equals(b.primaryKey)" at first.
But actually "a.details.equals(b.details)" is tested at first.
The cause is in ObjectMethods.makeEquals(). It should iterate in reverse order over the passed list of method handles.
Semantically, it is not necessarily a bug, but developers usually are placing the most distinct properties before other, more expensive objects to compare.
This can have extreme impact on application performance.
It not seems logical to place the most distinct properties at the end of a record.
Lets have a record "Data(Long primaryKey, Details details)" and two instances of it, "a" and "b".
The expected behaviour when calling "a.equals(b)" would be that the for records automatically generated code would test "a.primaryKey.equals(b.primaryKey)" at first.
But actually "a.details.equals(b.details)" is tested at first.
The cause is in ObjectMethods.makeEquals(). It should iterate in reverse order over the passed list of method handles.
Semantically, it is not necessarily a bug, but developers usually are placing the most distinct properties before other, more expensive objects to compare.
This can have extreme impact on application performance.
It not seems logical to place the most distinct properties at the end of a record.