RFR: 8322292: Rearrange comparison of fields in Record.equals()

Hannes Greule hgreule at openjdk.org
Tue Dec 19 11:03:37 UTC 2023


On Tue, 19 Dec 2023 09:41:45 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

> Isn't `Arrays.equals()` used under the hood?

The JLS and the API spec don't mention any special-casing of arrays, and the code seems to use `Objects.equals` for all non-primitive types: https://github.com/openjdk/jdk/blob/988601b324c971daf4e537074a007c25059af91b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java#L183-L187

(side note, it seems like `OBJECT_EQUALS` is unused?)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17143#issuecomment-1862550269


More information about the core-libs-dev mailing list