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 at runtime using a bootstrapping: https://github.com/openjdk/jdk/blob/9785e19f3f87306cabc26a862d35b89d41cfef93/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java#L382 The class file of a record only contains a stub equals/hashcode/to string which delegates to an invokedynamic call passing the class which allows the bootstrapped to get all record components and construct a method handle for the whole method implementation. When a record component is a float, the autogenerated impl using this impl to handle floats. 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 some more. 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org