Skip to content

Commit 188da51

Browse files
committed
8365699: Remove jdk.internal.javac.PreviewFeature.Feature enum values for features finalized in Java 25 or earlier
Reviewed-by: vromero, liach
1 parent d5831ed commit 188da51

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,27 @@
6464
* Values should be annotated with the feature's {@code JEP}.
6565
*/
6666
public enum Feature {
67-
// while building the interim javac, the ClassReader will produce a warning when loading a class
68-
// keeping the constant of a feature that has been integrated or dropped, serves the purpose of muting such warnings.
67+
// The JDK build process involves creating an interim javac which is then
68+
// used to compile the rest of the JDK. The jdk.internal.javac.PreviewFeature
69+
// annotation from the current sources is used when compiling interim javac.
70+
// That's because the javac APIs of the current sources may be annotated with
71+
// this annotation and they may be using the enum constants of the current sources.
72+
// Furthermore, when compiling interim javac, the class files from the bootstrap JDK get
73+
// used and those may also contain the PreviewFeature annotation. However, they may be
74+
// using the enum constants of the bootstrap JDK's PreviewFeature annotation.
75+
// If javac sees an annotation with an unknown enum constant, it produces a warning,
76+
// and that in turn fails the build.
77+
// So, in the current sources, we need to preserve the PreviewFeature enum constants
78+
// for as long as the interim javac build needs it. As a result, we retain PreviewFeature
79+
// enum constants for preview features that are present in the bootstrap JDK.
80+
// Older constants can be removed.
81+
//
82+
// For example, Class-File API became final in JDK 24. As soon as JDK 23 was dropped as
83+
// the bootstrap JDK, the CLASSFILE_API enum constant became eligible for removal.
6984

7085
//---
71-
IMPLICIT_CLASSES, //to be removed when boot JDK is 25
72-
SCOPED_VALUES,
7386
@JEP(number=505, title="Structured Concurrency", status="Fifth Preview")
7487
STRUCTURED_CONCURRENCY,
75-
CLASSFILE_API,
76-
STREAM_GATHERERS,
77-
MODULE_IMPORTS, //remove when the boot JDK is JDK 25
78-
KEY_DERIVATION, //remove when the boot JDK is JDK 25
7988
@JEP(number = 502, title = "Stable Values", status = "Preview")
8089
STABLE_VALUES,
8190
@JEP(number=470, title="PEM Encodings of Cryptographic Objects", status="Preview")

0 commit comments

Comments
 (0)