8334714: Implement JEP 484: Class-File API

Reviewed-by: liach, vromero
This commit is contained in:
Adam Sotona 2024-11-15 14:38:17 +00:00
parent 6cdebf0e4c
commit 84ffb64cd7
165 changed files with 312 additions and 799 deletions

View file

@ -33,7 +33,6 @@ import java.util.List;
import jdk.internal.classfile.impl.AnnotationImpl;
import jdk.internal.classfile.impl.TemporaryConstantPool;
import jdk.internal.classfile.impl.Util;
import jdk.internal.javac.PreviewFeature;
import static java.util.Objects.requireNonNull;
@ -48,18 +47,16 @@ import static java.util.Objects.requireNonNull;
* @see AnnotationElement
*
* @sealedGraph
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AnnotationValue {
/**
* Models an annotation value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_ANNOTATION}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfAnnotation extends AnnotationValue
permits AnnotationImpl.OfAnnotationImpl {
/** {@return the annotation value} */
@ -70,9 +67,8 @@ public sealed interface AnnotationValue {
* Models an array value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_ARRAY}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfArray extends AnnotationValue
permits AnnotationImpl.OfArrayImpl {
/**
@ -91,9 +87,8 @@ public sealed interface AnnotationValue {
* Models a constant value of an element-value pair.
*
* @sealedGraph
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfConstant extends AnnotationValue {
/**
* {@return the constant pool entry backing this constant element}
@ -128,9 +123,8 @@ public sealed interface AnnotationValue {
* Models a string value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_STRING}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfString extends OfConstant
permits AnnotationImpl.OfStringImpl {
/** {@return the backing UTF8 entry} */
@ -156,9 +150,8 @@ public sealed interface AnnotationValue {
* Models a double value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_DOUBLE}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfDouble extends OfConstant
permits AnnotationImpl.OfDoubleImpl {
/** {@return the backing double entry} */
@ -184,9 +177,8 @@ public sealed interface AnnotationValue {
* Models a float value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_FLOAT}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfFloat extends OfConstant
permits AnnotationImpl.OfFloatImpl {
/** {@return the backing float entry} */
@ -212,9 +204,8 @@ public sealed interface AnnotationValue {
* Models a long value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_LONG}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfLong extends OfConstant
permits AnnotationImpl.OfLongImpl {
/** {@return the backing long entry} */
@ -240,9 +231,8 @@ public sealed interface AnnotationValue {
* Models an int value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_INT}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfInt extends OfConstant
permits AnnotationImpl.OfIntImpl {
/** {@return the backing integer entry} */
@ -268,9 +258,8 @@ public sealed interface AnnotationValue {
* Models a short value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_SHORT}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfShort extends OfConstant
permits AnnotationImpl.OfShortImpl {
/** {@return the backing integer entry} */
@ -299,9 +288,8 @@ public sealed interface AnnotationValue {
* Models a char value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_CHAR}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfChar extends OfConstant
permits AnnotationImpl.OfCharImpl {
/** {@return the backing integer entry} */
@ -330,9 +318,8 @@ public sealed interface AnnotationValue {
* Models a byte value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_BYTE}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfByte extends OfConstant
permits AnnotationImpl.OfByteImpl {
/** {@return the backing integer entry} */
@ -361,9 +348,8 @@ public sealed interface AnnotationValue {
* Models a boolean value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_BOOLEAN}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfBoolean extends OfConstant
permits AnnotationImpl.OfBooleanImpl {
/** {@return the backing integer entry} */
@ -392,9 +378,8 @@ public sealed interface AnnotationValue {
* Models a class value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_CLASS}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfClass extends AnnotationValue
permits AnnotationImpl.OfClassImpl {
/** {@return the class descriptor string} */
@ -410,9 +395,8 @@ public sealed interface AnnotationValue {
* Models an enum value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value TAG_ENUM}.
*
* @since 22
* @since 24
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfEnum extends AnnotationValue
permits AnnotationImpl.OfEnumImpl {
/** {@return the enum class descriptor string} */