uschindler commented on code in PR #13328:
URL: https://github.com/apache/lucene/pull/13328#discussion_r1752842660
##########
lucene/sandbox/src/java/org/apache/lucene/sandbox/search/CombinedFieldQuery.java:
##########
@@ -163,11 +156,6 @@ public boolean equals(Object o) {
FieldAndWeight that = (FieldAndWeight) o;
return Float.compare(that.weight, weight) == 0 && Objects.equals(field,
that.field);
}
Review Comment:
Hi,
The equals methods for floats is generated by invokedynamic using a helper.
When a record component is a float, the autogenerated impl is generated at
runtime as combination of several Method handles. It compares them using this
code:
https://github.com/openjdk/jdk/blob/9785e19f3f87306cabc26a862d35b89d41cfef93/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java#L157
The method handles used by the code generator are saved in a map:
https://github.com/openjdk/jdk/blob/9785e19f3f87306cabc26a862d35b89d41cfef93/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java#L101
This is equivalent to the already existing code. So please remove all custom
equals methods.
Unfortunately in the merged PR there are so one more. I will add a not on
them. Please remove them in a followup.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]