JDK-8253555 : Make ByteSize and WordSize typed scoped enums
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-09-23
  • Updated: 2024-11-22
  • Resolved: 2020-09-25
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 16
16 b18Fixed
Related Reports
Relates :  
Description
The classes ByteSize and WordSize are used to create a typesafe differentiation between values denoting "words" and "bytes".

The way it works today is that ByteSize (and WordSize) is an int typedef in release builds, and a wrapper class in debug builds. This has the drawback that you can't use these types in overloads, because both types resolve to int in release builds.

I propose that we change this to with typed scoped enums, and get rid of the release/debug difference.
Comments
Changeset: 1f5a0334 Author: Stefan Karlsson <stefank@openjdk.org> Date: 2020-09-25 10:29:26 +0000 URL: https://git.openjdk.java.net/jdk/commit/1f5a0334
25-09-2020