JDK-8367382 : Expand use of representation equivalence terminology
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 26
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-09-11
  • Updated: 2025-09-15
  • Resolved: 2025-09-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 masterFixed
Related Reports
Relates :  
Description
JDK-8294539 introduced the term "representation equivalence" (among other terms) to describe one equivalence relation used by compare floating-point numbers. Besides in the equals and compareTo methods of Float and Double, the semantics of representation equivalence are appear in the discussion of the equivalence of records:

From java.lang.Record::equals:

Implementation Requirements:
    The implicitly provided implementation returns true if and only if the argument is an instance of the same record class as this record, and each component of this record is equal to the corresponding component of the argument; otherwise, false is returned. Equality of a component c is determined as follows:

       * If the component is of a reference type, the component is considered equal if and only if Objects.equals(this.c, r.c) would return true.
       * If the component is of a primitive type, using the corresponding primitive wrapper class PW (the corresponding wrapper class for int is java.lang.Integer, and so on), the component is considered equal if and only if PW.compare(this.c, r.c) would return 0. 

    Apart from the semantics described above, the precise algorithm used in the implicitly provided implementation is unspecified and is subject to change. The implementation may or may not use calls to the particular methods listed, and may or may not perform comparisons in the order of component declaration.

The documentation in these locations would be improved if "representation equivalence" was explicitly mentioned as a concept in addition to whatever coding idioms implementation representation equivalence were referred to.
Comments
Changeset: 58c9fbc9 Branch: master Author: Joe Darcy <darcy@openjdk.org> Date: 2025-09-15 16:22:35 +0000 URL: https://git.openjdk.org/jdk/commit/58c9fbc93db6c27b00d1e53d7ee8bf6e382eea82
15-09-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/27232 Date: 2025-09-11 17:56:29 +0000
11-09-2025