Skip to content

Commit

Permalink
8345344: Restore the preview status of java.lang.classfile.components…
Browse files Browse the repository at this point in the history
… package
  • Loading branch information
liach committed Dec 2, 2024
1 parent 940aa7c commit 5125233
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.stream.Stream;

import jdk.internal.classfile.impl.ClassPrinterImpl;
import jdk.internal.javac.PreviewFeature;

/**
* A printer of classfiles and its elements.
Expand All @@ -59,8 +60,9 @@
* Another use case for {@link ClassPrinter} is to simplify writing of automated tests:
* {@snippet lang="java" class="PackageSnippets" region="printNodesInTest"}
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public final class ClassPrinter {

private ClassPrinter() {
Expand All @@ -69,8 +71,9 @@ private ClassPrinter() {
/**
* Level of detail to print or export.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public enum Verbosity {

/**
Expand Down Expand Up @@ -103,8 +106,9 @@ public enum Verbosity {
/**
* Named, traversable, and printable node parent.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface Node {

/**
Expand Down Expand Up @@ -147,8 +151,9 @@ default void toYaml(Consumer<String> out) {
/**
* A leaf node holding single printable value.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface LeafNode extends Node
permits ClassPrinterImpl.LeafNodeImpl {

Expand All @@ -162,8 +167,9 @@ public sealed interface LeafNode extends Node
/**
* A tree node holding {@link List} of nested nodes.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface ListNode extends Node, List<Node>
permits ClassPrinterImpl.ListNodeImpl {
}
Expand All @@ -173,8 +179,9 @@ public sealed interface ListNode extends Node, List<Node>
* <p>
* Each {@link Map.Entry#getKey()} == {@link Map.Entry#getValue()}.{@link #name()}.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface MapNode extends Node, Map<ConstantDesc, Node>
permits ClassPrinterImpl.MapNodeImpl {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.function.Function;

import jdk.internal.classfile.impl.ClassRemapperImpl;
import jdk.internal.javac.PreviewFeature;

import static java.util.Objects.requireNonNull;

Expand All @@ -54,8 +55,9 @@
* Arrays of reference types are always decomposed, mapped as the base reference
* types and composed back to arrays.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface ClassRemapper extends ClassTransform permits ClassRemapperImpl {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@
import java.lang.reflect.AccessFlag;

import jdk.internal.classfile.impl.CodeLocalsShifterImpl;
import jdk.internal.javac.PreviewFeature;

/**
* {@link CodeLocalsShifter} is a {@link CodeTransform} shifting locals to
* newly allocated positions to avoid conflicts during code injection.
* Locals pointing to the receiver or to method arguments slots are never shifted.
* All locals pointing beyond the method arguments are re-indexed in order of appearance.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface CodeLocalsShifter extends CodeTransform permits CodeLocalsShifterImpl {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.function.BiFunction;

import jdk.internal.classfile.impl.CodeRelabelerImpl;
import jdk.internal.javac.PreviewFeature;

import static java.util.Objects.requireNonNull;

Expand All @@ -45,8 +46,9 @@
* Repeated injection of the same code block must be relabeled, so each instance of
* {@link java.lang.classfile.Label} is bound in the target bytecode exactly once.
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface CodeRelabeler extends CodeTransform permits CodeRelabelerImpl {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.Optional;

import jdk.internal.classfile.impl.CodeStackTrackerImpl;
import jdk.internal.javac.PreviewFeature;

/**
* {@link CodeStackTracker} is a {@link CodeTransform} tracking stack content
Expand All @@ -50,8 +51,9 @@
* });
* }
*
* @since 24
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface CodeStackTracker extends CodeTransform permits CodeStackTrackerImpl {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@
*
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
package java.lang.classfile.components;

import jdk.internal.javac.PreviewFeature;
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public enum Feature {
SCOPED_VALUES,
@JEP(number=499, title="Structured Concurrency", status="Fourth Preview")
STRUCTURED_CONCURRENCY,
@JEP(number=484, title="Class-File API", status="Third Preview")
CLASSFILE_API,
STREAM_GATHERERS,
@JEP(number=494, title="Module Import Declarations", status="Second Preview")
Expand Down

0 comments on commit 5125233

Please sign in to comment.