Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8334714: Implement JEP 484: Class-File API #19826

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@
import java.util.Set;
import jdk.internal.classfile.impl.AccessFlagsImpl;
import java.lang.reflect.AccessFlag;
import jdk.internal.javac.PreviewFeature;

/**
* Models the access flags for a class, method, or field. Delivered as a
* {@link ClassElement}, {@link FieldElement}, or {@link MethodElement}
* when traversing the corresponding model type.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AccessFlags
extends ClassElement, MethodElement, FieldElement
permits AccessFlagsImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import java.lang.constant.ClassDesc;
import java.util.List;
import jdk.internal.javac.PreviewFeature;

/**
* Models an annotation on a declaration.
Expand All @@ -47,9 +46,8 @@
* @see RuntimeInvisibleParameterAnnotationsAttribute
*
* @sealedGraph
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface Annotation
extends WritableElement<Annotation>
permits TypeAnnotation, AnnotationImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@
import java.lang.classfile.constantpool.Utf8Entry;
import jdk.internal.classfile.impl.AnnotationImpl;
import jdk.internal.classfile.impl.TemporaryConstantPool;
import jdk.internal.javac.PreviewFeature;

/**
* Models a key-value pair of an annotation.
*
* @see Annotation
* @see AnnotationValue
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AnnotationElement
extends WritableElement<AnnotationElement>
permits AnnotationImpl.AnnotationElementImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.lang.constant.ConstantDesc;
import java.util.ArrayList;
import java.util.List;
import jdk.internal.javac.PreviewFeature;

/**
* Models the value of a key-value pair of an annotation.
Expand All @@ -46,9 +45,8 @@
* @see AnnotationElement
*
* @sealedGraph
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
permits AnnotationValue.OfAnnotation, AnnotationValue.OfArray,
AnnotationValue.OfConstant, AnnotationValue.OfClass,
Expand All @@ -57,9 +55,8 @@ public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
/**
* Models an annotation-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfAnnotation extends AnnotationValue
permits AnnotationImpl.OfAnnotationImpl {
/** {@return the annotation} */
Expand All @@ -69,9 +66,8 @@ sealed interface OfAnnotation extends AnnotationValue
/**
* Models an array-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfArray extends AnnotationValue
permits AnnotationImpl.OfArrayImpl {
/** {@return the values} */
Expand All @@ -82,9 +78,8 @@ sealed interface OfArray extends AnnotationValue
* Models a constant-valued element
*
* @sealedGraph
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfConstant extends AnnotationValue
permits AnnotationValue.OfString, AnnotationValue.OfDouble,
AnnotationValue.OfFloat, AnnotationValue.OfLong,
Expand All @@ -100,9 +95,8 @@ sealed interface OfConstant extends AnnotationValue
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfString extends AnnotationValue.OfConstant
permits AnnotationImpl.OfStringImpl {
/** {@return the constant} */
Expand All @@ -112,9 +106,8 @@ sealed interface OfString extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfDouble extends AnnotationValue.OfConstant
permits AnnotationImpl.OfDoubleImpl {
/** {@return the constant} */
Expand All @@ -124,9 +117,8 @@ sealed interface OfDouble extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfFloat extends AnnotationValue.OfConstant
permits AnnotationImpl.OfFloatImpl {
/** {@return the constant} */
Expand All @@ -136,9 +128,8 @@ sealed interface OfFloat extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfLong extends AnnotationValue.OfConstant
permits AnnotationImpl.OfLongImpl {
/** {@return the constant} */
Expand All @@ -148,9 +139,8 @@ sealed interface OfLong extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfInteger extends AnnotationValue.OfConstant
permits AnnotationImpl.OfIntegerImpl {
/** {@return the constant} */
Expand All @@ -160,9 +150,8 @@ sealed interface OfInteger extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfShort extends AnnotationValue.OfConstant
permits AnnotationImpl.OfShortImpl {
/** {@return the constant} */
Expand All @@ -172,9 +161,8 @@ sealed interface OfShort extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfCharacter extends AnnotationValue.OfConstant
permits AnnotationImpl.OfCharacterImpl {
/** {@return the constant} */
Expand All @@ -184,9 +172,8 @@ sealed interface OfCharacter extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfByte extends AnnotationValue.OfConstant
permits AnnotationImpl.OfByteImpl {
/** {@return the constant} */
Expand All @@ -196,9 +183,8 @@ sealed interface OfByte extends AnnotationValue.OfConstant
/**
* Models a constant-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfBoolean extends AnnotationValue.OfConstant
permits AnnotationImpl.OfBooleanImpl {
/** {@return the constant} */
Expand All @@ -208,9 +194,8 @@ sealed interface OfBoolean extends AnnotationValue.OfConstant
/**
* Models a class-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfClass extends AnnotationValue
permits AnnotationImpl.OfClassImpl {
/** {@return the class name} */
Expand All @@ -225,9 +210,8 @@ default ClassDesc classSymbol() {
/**
* Models an enum-valued element
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfEnum extends AnnotationValue
permits AnnotationImpl.OfEnumImpl {
/** {@return the enum class name} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
import java.lang.classfile.attribute.UnknownAttribute;
import jdk.internal.classfile.impl.BoundAttribute;
import jdk.internal.classfile.impl.UnboundAttribute;
import jdk.internal.javac.PreviewFeature;

/**
* Models a classfile attribute {@jvms 4.7}. Many, though not all, subtypes of
Expand All @@ -76,9 +75,8 @@
* @param <A> the attribute type
*
* @sealedGraph
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface Attribute<A extends Attribute<A>>
extends WritableElement<A>
permits AnnotationDefaultAttribute, BootstrapMethodsAttribute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
package java.lang.classfile;

import jdk.internal.javac.PreviewFeature;

/**
* Bidirectional mapper between the classfile representation of an attribute and
* how that attribute is modeled in the API. The attribute mapper is used
Expand All @@ -37,17 +35,15 @@
* CustomAttribute}.
* @param <A> the attribute type
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public interface AttributeMapper<A> {

/**
* Attribute stability indicator
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
enum AttributeStability {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@

import java.lang.classfile.attribute.RecordComponentInfo;
import jdk.internal.classfile.impl.AbstractUnboundModel;
import jdk.internal.javac.PreviewFeature;

/**
* A {@link ClassFileElement} describing an entity that has attributes, such
* as a class, field, method, code attribute, or record component.
*
* @sealedGraph
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AttributedElement extends ClassFileElement
permits ClassModel, CodeModel, FieldModel, MethodModel,
RecordComponentInfo, AbstractUnboundModel {
Expand Down
Loading