-
CSR
-
Resolution: Approved
-
P3
-
None
-
source
-
minimal
-
Removal of preview APIs has minimal compatibility risk.
-
Java API
-
SE
Summary
Temporarily move the java.lang.classfile.components
to an internal package (jdk.internal.classfile.components
).
Problem
The classes in java.lang.classfile.components
received relatively little attention during reviews compared to other core classfile API classes (in the root package, attribute
, instruction
, or constantpool
subpackages). To deliver the best classfile API we can, we would like to buy us some time to reevaluate the classes in this package.
Solution
Unfortunately, given the little time left available to make changes in Java 24, the only realistic option left available to us is to temporarily move the java.lang.classfile.components
to an internal package (jdk.internal.classfile.components
). Other considered options include re-previewing the package, or moving the package to an incubator module, which are not possible due to the time requirements associated with the JEP process.
Specification
Removed public API java files:
rename from src/java.base/share/classes/java/lang/classfile/components/ClassPrinter.java
rename to src/java.base/share/classes/jdk/internal/classfile/components/ClassPrinter.java
rename from src/java.base/share/classes/java/lang/classfile/components/ClassRemapper.java
rename to src/java.base/share/classes/jdk/internal/classfile/components/ClassRemapper.java
rename from src/java.base/share/classes/java/lang/classfile/components/CodeLocalsShifter.java
rename to src/java.base/share/classes/jdk/internal/classfile/components/CodeLocalsShifter.java
rename from src/java.base/share/classes/java/lang/classfile/components/CodeRelabeler.java
rename to src/java.base/share/classes/jdk/internal/classfile/components/CodeRelabeler.java
rename from src/java.base/share/classes/java/lang/classfile/components/CodeStackTracker.java
rename to src/java.base/share/classes/jdk/internal/classfile/components/CodeStackTracker.java
rename from src/java.base/share/classes/java/lang/classfile/components/package-info.java
rename to src/java.base/share/classes/jdk/internal/classfile/components/package-info.java
Note that ClassPrinter.java
has nested classes ClassPrinter.Node
, ClassPrinter.LeafNode
, ClassPrinter.ListNode
, ClassPrinter.MapNode
.
--- a/src/java.base/share/classes/java/lang/classfile/ClassFileTransform.java
+++ b/src/java.base/share/classes/java/lang/classfile/ClassFileTransform.java
@@ -60,12 +60,7 @@
* its state must be reset for each traversal; this will happen automatically if
* the transform is created with {@link ClassTransform#ofStateful(Supplier)} (or
* corresponding methods for other classfile locations.)
- * <p>
- * Class transformation sample where code transformation is stateful:
- * {@snippet lang="java" class="PackageSnippets" region="codeRelabeling"}
- * <p>
- * Complex class instrumentation sample chaining multiple transformations:
- * {@snippet lang="java" class="PackageSnippets" region="classInstrumentation"}
+ *
* @param <C> the transform type
* @param <E> the element type
* @param <B> the builder type
- csr of
-
JDK-8345486 Reevaluate the classes in java.lang.classfile.components package
-
- Resolved
-