RFR: 8362637: Convert java.nio.ByteOrder to an enum

Roger Riggs rriggs at openjdk.org
Mon Oct 6 18:27:41 UTC 2025


Convert java.nio.ByteOrder to an enum.
The class declaration is changed from `public class` to `public enum`.
Enums are `Comparable` so declare LITTLE_ENDIAN before BIG_ENDIAN so LITTLE_ENDIAN is less than BIG_ENDIAN. 
The implementation is simplified, removing the constructor and explicit static fields. 
Remove the override of `toString`; the javadoc provided by Enum is sufficient.

No changes to other classes or implementations are needed to pass Tier 1-3.

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

Commit messages:
 - 8362637: Convert java.nio.ByteOrder to an enum

Changes: https://git.openjdk.org/jdk/pull/27657/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27657&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8362637
  Stats: 37 lines in 1 file changed: 5 ins; 28 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/27657.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27657/head:pull/27657

PR: https://git.openjdk.org/jdk/pull/27657


More information about the nio-dev mailing list