JDK-8265130 : Make ConstantDesc class hierarchy sealed
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-04-13
  • Updated: 2022-03-19
  • Resolved: 2021-06-02
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 17
17 b25Fixed
Related Reports
CSR :  
Relates :  
Description
The class hierarchy rooted at `ConstantDesc` in package `java.language.constant` is used to denote a nominal descriptor for a loadable constant value, as defined in JVMS 4.4.

The javadoc for these classes mentions that this hierarchy may become sealed if supported by the Java language, for example:

* @apiNote In the future, if the Java language permits, {@linkplain ConstantDesc}
 * may become a {@code sealed} interface, which would prohibit subclassing except by
 * explicitly permitted types.  Clients can assume that the following
 * set of subtypes is exhaustive: {@link String}, {@link Integer},
 * {@link Long}, {@link Float}, {@link Double}, {@link ClassDesc},
 * {@link MethodTypeDesc}, {@link MethodHandleDesc}, and
 * {@link DynamicConstantDesc}; this list may be extended to reflect future
 * changes to the constant pool format as defined in JVMS 4.4.
 

Now JEP 409 proposes that sealed classes become a final feature, we can amend the class hierarchy to be sealed.
Comments
Changeset: 379376f0 Author: Gavin Bierman <gbierman@openjdk.org> Committer: Vicente Romero <vromero@openjdk.org> Date: 2021-06-02 00:49:49 +0000 URL: https://git.openjdk.java.net/jdk/commit/379376f0783facba93e1d11db9b184ef8183a13b
02-06-2021