8308753: Class-File API transition to Preview
Reviewed-by: ihse, mchung, vromero
This commit is contained in:
parent
b9df827adc
commit
2b00ac0d02
@ -473,6 +473,11 @@ public class GenModuleInfoSource {
|
||||
if (parser.peekToken() != null) { // must be EOF
|
||||
throw parser.newError("is malformed");
|
||||
}
|
||||
} else if (token.equals("import")) {
|
||||
nextIdentifier(parser);
|
||||
skipTokenOrThrow(parser, ";", "missing semicolon");
|
||||
} else if (token.startsWith("@")) {
|
||||
continue;
|
||||
} else {
|
||||
throw parser.newError("missing keyword");
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ EXCLUDE_FILES += \
|
||||
$(TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java
|
||||
|
||||
EXCLUDES += java/lang/doc-files \
|
||||
jdk/internal/classfile/snippet-files \
|
||||
jdk/internal/classfile/components/snippet-files
|
||||
java/lang/classfile/snippet-files \
|
||||
java/lang/classfile/components/snippet-files
|
||||
|
||||
# Exclude BreakIterator classes that are just used in compile process to generate
|
||||
# data files and shouldn't go in the product
|
||||
|
@ -98,11 +98,6 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
|
||||
BIN := $(MICROBENCHMARK_CLASSES), \
|
||||
JAVAC_FLAGS := --add-exports java.base/sun.security.util=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.attribute=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.instruction=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.components=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.impl=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
|
||||
|
@ -52,13 +52,13 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.internal.classfile.AccessFlags;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassModel;
|
||||
import jdk.internal.classfile.ClassTransform;
|
||||
import jdk.internal.classfile.Classfile;
|
||||
import jdk.internal.classfile.attribute.ModuleAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.AccessFlags;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassModel;
|
||||
import java.lang.classfile.ClassTransform;
|
||||
import java.lang.classfile.ClassFile;
|
||||
import java.lang.classfile.attribute.ModuleAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
import jdk.internal.loader.BuiltinClassLoader;
|
||||
@ -1591,7 +1591,7 @@ public final class Module implements AnnotatedElement {
|
||||
*/
|
||||
private Class<?> loadModuleInfoClass(InputStream in) throws IOException {
|
||||
final String MODULE_INFO = "module-info";
|
||||
var cc = Classfile.of(Classfile.ConstantPoolSharingOption.NEW_POOL);
|
||||
var cc = ClassFile.of(ClassFile.ConstantPoolSharingOption.NEW_POOL);
|
||||
byte[] bytes = cc.transform(cc.parse(in.readAllBytes()), (clb, cle) -> {
|
||||
switch (cle) {
|
||||
case AccessFlags af -> clb.withFlags(AccessFlag.INTERFACE,
|
||||
|
@ -22,17 +22,21 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
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
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface AccessFlags
|
||||
extends ClassElement, MethodElement, FieldElement
|
||||
permits AccessFlagsImpl {
|
@ -22,18 +22,19 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.AnnotationImpl;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.List;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models an annotation on a declaration.
|
||||
@ -44,7 +45,11 @@ import java.util.List;
|
||||
* @see RuntimeInvisibleAnnotationsAttribute
|
||||
* @see RuntimeVisibleParameterAnnotationsAttribute
|
||||
* @see RuntimeInvisibleParameterAnnotationsAttribute
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface Annotation
|
||||
extends WritableElement<Annotation>
|
||||
permits TypeAnnotation, AnnotationImpl {
|
@ -22,20 +22,24 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
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
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface AnnotationElement
|
||||
extends WritableElement<AnnotationElement>
|
||||
permits AnnotationImpl.AnnotationElementImpl {
|
@ -22,14 +22,14 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.constantpool.AnnotationConstantValueEntry;
|
||||
import jdk.internal.classfile.constantpool.DoubleEntry;
|
||||
import jdk.internal.classfile.constantpool.FloatEntry;
|
||||
import jdk.internal.classfile.constantpool.IntegerEntry;
|
||||
import jdk.internal.classfile.constantpool.LongEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.AnnotationConstantValueEntry;
|
||||
import java.lang.classfile.constantpool.DoubleEntry;
|
||||
import java.lang.classfile.constantpool.FloatEntry;
|
||||
import java.lang.classfile.constantpool.IntegerEntry;
|
||||
import java.lang.classfile.constantpool.LongEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.AnnotationImpl;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
|
||||
@ -37,34 +37,54 @@ import java.lang.constant.ClassDesc;
|
||||
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.
|
||||
*
|
||||
* @see Annotation
|
||||
* @see AnnotationElement
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
|
||||
permits AnnotationValue.OfAnnotation, AnnotationValue.OfArray,
|
||||
AnnotationValue.OfConstant, AnnotationValue.OfClass,
|
||||
AnnotationValue.OfEnum {
|
||||
|
||||
/** Models an annotation-valued element */
|
||||
/**
|
||||
* Models an annotation-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfAnnotation extends AnnotationValue
|
||||
permits AnnotationImpl.OfAnnotationImpl {
|
||||
/** {@return the annotation} */
|
||||
Annotation annotation();
|
||||
}
|
||||
|
||||
/** Models an array-valued element */
|
||||
/**
|
||||
* Models an array-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfArray extends AnnotationValue
|
||||
permits AnnotationImpl.OfArrayImpl {
|
||||
/** {@return the values} */
|
||||
List<AnnotationValue> values();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfConstant extends AnnotationValue
|
||||
permits AnnotationValue.OfString, AnnotationValue.OfDouble,
|
||||
AnnotationValue.OfFloat, AnnotationValue.OfLong,
|
||||
@ -77,70 +97,120 @@ public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
|
||||
ConstantDesc constantValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfString extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfStringImpl {
|
||||
/** {@return the constant} */
|
||||
String stringValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfDouble extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfDoubleImpl {
|
||||
/** {@return the constant} */
|
||||
double doubleValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfFloat extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfFloatImpl {
|
||||
/** {@return the constant} */
|
||||
float floatValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfLong extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfLongImpl {
|
||||
/** {@return the constant} */
|
||||
long longValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfInteger extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfIntegerImpl {
|
||||
/** {@return the constant} */
|
||||
int intValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfShort extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfShortImpl {
|
||||
/** {@return the constant} */
|
||||
short shortValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfCharacter extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfCharacterImpl {
|
||||
/** {@return the constant} */
|
||||
char charValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfByte extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfByteImpl {
|
||||
/** {@return the constant} */
|
||||
byte byteValue();
|
||||
}
|
||||
|
||||
/** Models a constant-valued element */
|
||||
/**
|
||||
* Models a constant-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfBoolean extends AnnotationValue.OfConstant
|
||||
permits AnnotationImpl.OfBooleanImpl {
|
||||
/** {@return the constant} */
|
||||
boolean booleanValue();
|
||||
}
|
||||
|
||||
/** Models a class-valued element */
|
||||
/**
|
||||
* Models a class-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfClass extends AnnotationValue
|
||||
permits AnnotationImpl.OfClassImpl {
|
||||
/** {@return the class name} */
|
||||
@ -152,7 +222,12 @@ public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
|
||||
}
|
||||
}
|
||||
|
||||
/** Models an enum-valued element */
|
||||
/**
|
||||
* Models an enum-valued element
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OfEnum extends AnnotationValue
|
||||
permits AnnotationImpl.OfEnumImpl {
|
||||
/** {@return the enum class name} */
|
||||
@ -168,7 +243,7 @@ public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tag character for this type as per {@jvms 4.7.16.1}
|
||||
* {@return the tag character for this type as per {@jvms 4.7.16.1}}
|
||||
*/
|
||||
char tag();
|
||||
|
||||
@ -379,10 +454,13 @@ public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
|
||||
|
||||
/**
|
||||
* {@return an annotation element} The {@code value} parameter must be
|
||||
* a primitive, a String, a ClassDesc, an enum constant, or an array of
|
||||
* one of these.
|
||||
* a primitive, a wrapper of primitive, a String, a ClassDesc, an enum
|
||||
* constant, or an array of one of these.
|
||||
*
|
||||
* @param value the annotation value
|
||||
* @throws IllegalArgumentException when the {@code value} parameter is not
|
||||
* a primitive, a wrapper of primitive, a String, a ClassDesc,
|
||||
* an enum constant, or an array of one of these.
|
||||
*/
|
||||
static AnnotationValue of(Object value) {
|
||||
if (value instanceof String s) {
|
@ -22,47 +22,48 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.attribute.AnnotationDefaultAttribute;
|
||||
import jdk.internal.classfile.attribute.BootstrapMethodsAttribute;
|
||||
import jdk.internal.classfile.attribute.CharacterRangeTableAttribute;
|
||||
import jdk.internal.classfile.attribute.CodeAttribute;
|
||||
import jdk.internal.classfile.attribute.CompilationIDAttribute;
|
||||
import jdk.internal.classfile.attribute.ConstantValueAttribute;
|
||||
import jdk.internal.classfile.attribute.DeprecatedAttribute;
|
||||
import jdk.internal.classfile.attribute.EnclosingMethodAttribute;
|
||||
import jdk.internal.classfile.attribute.ExceptionsAttribute;
|
||||
import jdk.internal.classfile.attribute.InnerClassesAttribute;
|
||||
import jdk.internal.classfile.attribute.LineNumberTableAttribute;
|
||||
import jdk.internal.classfile.attribute.LocalVariableTableAttribute;
|
||||
import jdk.internal.classfile.attribute.LocalVariableTypeTableAttribute;
|
||||
import jdk.internal.classfile.attribute.MethodParametersAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleHashesAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleMainClassAttribute;
|
||||
import jdk.internal.classfile.attribute.ModulePackagesAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleResolutionAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleTargetAttribute;
|
||||
import jdk.internal.classfile.attribute.NestHostAttribute;
|
||||
import jdk.internal.classfile.attribute.NestMembersAttribute;
|
||||
import jdk.internal.classfile.attribute.PermittedSubclassesAttribute;
|
||||
import jdk.internal.classfile.attribute.RecordAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.SignatureAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceDebugExtensionAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceFileAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceIDAttribute;
|
||||
import jdk.internal.classfile.attribute.StackMapTableAttribute;
|
||||
import jdk.internal.classfile.attribute.SyntheticAttribute;
|
||||
import jdk.internal.classfile.attribute.UnknownAttribute;
|
||||
import java.lang.classfile.attribute.AnnotationDefaultAttribute;
|
||||
import java.lang.classfile.attribute.BootstrapMethodsAttribute;
|
||||
import java.lang.classfile.attribute.CharacterRangeTableAttribute;
|
||||
import java.lang.classfile.attribute.CodeAttribute;
|
||||
import java.lang.classfile.attribute.CompilationIDAttribute;
|
||||
import java.lang.classfile.attribute.ConstantValueAttribute;
|
||||
import java.lang.classfile.attribute.DeprecatedAttribute;
|
||||
import java.lang.classfile.attribute.EnclosingMethodAttribute;
|
||||
import java.lang.classfile.attribute.ExceptionsAttribute;
|
||||
import java.lang.classfile.attribute.InnerClassesAttribute;
|
||||
import java.lang.classfile.attribute.LineNumberTableAttribute;
|
||||
import java.lang.classfile.attribute.LocalVariableTableAttribute;
|
||||
import java.lang.classfile.attribute.LocalVariableTypeTableAttribute;
|
||||
import java.lang.classfile.attribute.MethodParametersAttribute;
|
||||
import java.lang.classfile.attribute.ModuleAttribute;
|
||||
import java.lang.classfile.attribute.ModuleHashesAttribute;
|
||||
import java.lang.classfile.attribute.ModuleMainClassAttribute;
|
||||
import java.lang.classfile.attribute.ModulePackagesAttribute;
|
||||
import java.lang.classfile.attribute.ModuleResolutionAttribute;
|
||||
import java.lang.classfile.attribute.ModuleTargetAttribute;
|
||||
import java.lang.classfile.attribute.NestHostAttribute;
|
||||
import java.lang.classfile.attribute.NestMembersAttribute;
|
||||
import java.lang.classfile.attribute.PermittedSubclassesAttribute;
|
||||
import java.lang.classfile.attribute.RecordAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.SignatureAttribute;
|
||||
import java.lang.classfile.attribute.SourceDebugExtensionAttribute;
|
||||
import java.lang.classfile.attribute.SourceFileAttribute;
|
||||
import java.lang.classfile.attribute.SourceIDAttribute;
|
||||
import java.lang.classfile.attribute.StackMapTableAttribute;
|
||||
import java.lang.classfile.attribute.SyntheticAttribute;
|
||||
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
|
||||
@ -73,7 +74,11 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* directly from the corresponding model type through {@link
|
||||
* AttributedElement#findAttribute(AttributeMapper)}.
|
||||
* @param <A> the attribute type
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface Attribute<A extends Attribute<A>>
|
||||
extends WritableElement<A>
|
||||
permits AnnotationDefaultAttribute, BootstrapMethodsAttribute,
|
||||
@ -91,7 +96,7 @@ public sealed interface Attribute<A extends Attribute<A>>
|
||||
RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute,
|
||||
SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute,
|
||||
StackMapTableAttribute, SyntheticAttribute,
|
||||
UnknownAttribute, BoundAttribute, UnboundAttribute {
|
||||
UnknownAttribute, BoundAttribute, UnboundAttribute, CustomAttribute {
|
||||
/**
|
||||
* {@return the name of the attribute}
|
||||
*/
|
@ -22,7 +22,9 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Bidirectional mapper between the classfile representation of an attribute and
|
||||
@ -34,12 +36,18 @@ package jdk.internal.classfile;
|
||||
* Classes that model nonstandard attributes should extend {@link
|
||||
* CustomAttribute}.
|
||||
* @param <A> the attribute type
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public interface AttributeMapper<A> {
|
||||
|
||||
/**
|
||||
* Attribute stability indicator
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
enum AttributeStability {
|
||||
|
||||
/**
|
||||
@ -60,13 +68,13 @@ public interface AttributeMapper<A> {
|
||||
|
||||
/**
|
||||
* The attribute may contain indexes into structured not managed by the library (type variable lists, etc)
|
||||
* and so we consult the {@link Classfile.AttributesProcessingOption} option to determine whether to preserve
|
||||
* and so we consult the {@link ClassFile.AttributesProcessingOption} option to determine whether to preserve
|
||||
* or drop it during transformation.
|
||||
*/
|
||||
UNSTABLE,
|
||||
|
||||
/**
|
||||
* The attribute is completely unknown and so we consult the {@link Classfile.AttributesProcessingOption} option
|
||||
* The attribute is completely unknown and so we consult the {@link ClassFile.AttributesProcessingOption} option
|
||||
* to determine whether to preserve or drop it during transformation.
|
||||
*/
|
||||
UNKNOWN
|
||||
@ -96,16 +104,10 @@ public interface AttributeMapper<A> {
|
||||
*/
|
||||
void writeAttribute(BufWriter buf, A attr);
|
||||
|
||||
/**
|
||||
* {@return The earliest classfile version for which this attribute is
|
||||
* applicable}
|
||||
*/
|
||||
default int validSince() {
|
||||
return Classfile.JAVA_1_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return whether this attribute may appear more than once in a given location}
|
||||
*
|
||||
* @implSpec The default implementation returns {@code false}
|
||||
*/
|
||||
default boolean allowMultiple() {
|
||||
return false;
|
@ -22,20 +22,25 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.internal.classfile.attribute.RecordComponentInfo;
|
||||
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
|
||||
* A {@link ClassFileElement} describing an entity that has attributes, such
|
||||
* as a class, field, method, code attribute, or record component.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface AttributedElement extends ClassfileElement
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface AttributedElement extends ClassFileElement
|
||||
permits ClassModel, CodeModel, FieldModel, MethodModel,
|
||||
RecordComponentInfo, AbstractUnboundModel {
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -30,66 +30,70 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.classfile.attribute.AnnotationDefaultAttribute;
|
||||
import jdk.internal.classfile.attribute.BootstrapMethodsAttribute;
|
||||
import jdk.internal.classfile.attribute.CharacterRangeInfo;
|
||||
import jdk.internal.classfile.attribute.CharacterRangeTableAttribute;
|
||||
import jdk.internal.classfile.attribute.CodeAttribute;
|
||||
import jdk.internal.classfile.attribute.CompilationIDAttribute;
|
||||
import jdk.internal.classfile.attribute.ConstantValueAttribute;
|
||||
import jdk.internal.classfile.attribute.DeprecatedAttribute;
|
||||
import jdk.internal.classfile.attribute.EnclosingMethodAttribute;
|
||||
import jdk.internal.classfile.attribute.ExceptionsAttribute;
|
||||
import jdk.internal.classfile.attribute.InnerClassInfo;
|
||||
import jdk.internal.classfile.attribute.InnerClassesAttribute;
|
||||
import jdk.internal.classfile.attribute.LineNumberInfo;
|
||||
import jdk.internal.classfile.attribute.LineNumberTableAttribute;
|
||||
import jdk.internal.classfile.attribute.LocalVariableInfo;
|
||||
import jdk.internal.classfile.attribute.LocalVariableTableAttribute;
|
||||
import jdk.internal.classfile.attribute.LocalVariableTypeInfo;
|
||||
import jdk.internal.classfile.attribute.LocalVariableTypeTableAttribute;
|
||||
import jdk.internal.classfile.attribute.MethodParameterInfo;
|
||||
import jdk.internal.classfile.attribute.MethodParametersAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleExportInfo;
|
||||
import jdk.internal.classfile.attribute.ModuleHashInfo;
|
||||
import jdk.internal.classfile.attribute.ModuleHashesAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleMainClassAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleOpenInfo;
|
||||
import jdk.internal.classfile.attribute.ModulePackagesAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleProvideInfo;
|
||||
import jdk.internal.classfile.attribute.ModuleRequireInfo;
|
||||
import jdk.internal.classfile.attribute.ModuleResolutionAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleTargetAttribute;
|
||||
import jdk.internal.classfile.attribute.NestHostAttribute;
|
||||
import jdk.internal.classfile.attribute.NestMembersAttribute;
|
||||
import jdk.internal.classfile.attribute.PermittedSubclassesAttribute;
|
||||
import jdk.internal.classfile.attribute.RecordAttribute;
|
||||
import jdk.internal.classfile.attribute.RecordComponentInfo;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.SignatureAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceDebugExtensionAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceFileAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceIDAttribute;
|
||||
import jdk.internal.classfile.attribute.StackMapTableAttribute;
|
||||
import jdk.internal.classfile.attribute.SyntheticAttribute;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.attribute.AnnotationDefaultAttribute;
|
||||
import java.lang.classfile.attribute.BootstrapMethodsAttribute;
|
||||
import java.lang.classfile.attribute.CharacterRangeInfo;
|
||||
import java.lang.classfile.attribute.CharacterRangeTableAttribute;
|
||||
import java.lang.classfile.attribute.CodeAttribute;
|
||||
import java.lang.classfile.attribute.CompilationIDAttribute;
|
||||
import java.lang.classfile.attribute.ConstantValueAttribute;
|
||||
import java.lang.classfile.attribute.DeprecatedAttribute;
|
||||
import java.lang.classfile.attribute.EnclosingMethodAttribute;
|
||||
import java.lang.classfile.attribute.ExceptionsAttribute;
|
||||
import java.lang.classfile.attribute.InnerClassInfo;
|
||||
import java.lang.classfile.attribute.InnerClassesAttribute;
|
||||
import java.lang.classfile.attribute.LineNumberInfo;
|
||||
import java.lang.classfile.attribute.LineNumberTableAttribute;
|
||||
import java.lang.classfile.attribute.LocalVariableInfo;
|
||||
import java.lang.classfile.attribute.LocalVariableTableAttribute;
|
||||
import java.lang.classfile.attribute.LocalVariableTypeInfo;
|
||||
import java.lang.classfile.attribute.LocalVariableTypeTableAttribute;
|
||||
import java.lang.classfile.attribute.MethodParameterInfo;
|
||||
import java.lang.classfile.attribute.MethodParametersAttribute;
|
||||
import java.lang.classfile.attribute.ModuleAttribute;
|
||||
import java.lang.classfile.attribute.ModuleExportInfo;
|
||||
import java.lang.classfile.attribute.ModuleHashInfo;
|
||||
import java.lang.classfile.attribute.ModuleHashesAttribute;
|
||||
import java.lang.classfile.attribute.ModuleMainClassAttribute;
|
||||
import java.lang.classfile.attribute.ModuleOpenInfo;
|
||||
import java.lang.classfile.attribute.ModulePackagesAttribute;
|
||||
import java.lang.classfile.attribute.ModuleProvideInfo;
|
||||
import java.lang.classfile.attribute.ModuleRequireInfo;
|
||||
import java.lang.classfile.attribute.ModuleResolutionAttribute;
|
||||
import java.lang.classfile.attribute.ModuleTargetAttribute;
|
||||
import java.lang.classfile.attribute.NestHostAttribute;
|
||||
import java.lang.classfile.attribute.NestMembersAttribute;
|
||||
import java.lang.classfile.attribute.PermittedSubclassesAttribute;
|
||||
import java.lang.classfile.attribute.RecordAttribute;
|
||||
import java.lang.classfile.attribute.RecordComponentInfo;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.SignatureAttribute;
|
||||
import java.lang.classfile.attribute.SourceDebugExtensionAttribute;
|
||||
import java.lang.classfile.attribute.SourceFileAttribute;
|
||||
import java.lang.classfile.attribute.SourceIDAttribute;
|
||||
import java.lang.classfile.attribute.StackMapTableAttribute;
|
||||
import java.lang.classfile.attribute.SyntheticAttribute;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.AbstractAttributeMapper;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.CodeImpl;
|
||||
import jdk.internal.classfile.impl.AbstractPoolEntry;
|
||||
import jdk.internal.classfile.impl.StackMapDecoder;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Attribute mappers for standard classfile attributes.
|
||||
*
|
||||
* @see AttributeMapper
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public class Attributes {
|
||||
|
||||
/** AnnotationDefault */
|
||||
@ -167,10 +171,10 @@ public class Attributes {
|
||||
/** RuntimeInvisibleAnnotations */
|
||||
public static final String NAME_RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations";
|
||||
|
||||
/** RuntimeInvisibleTypeAnnotations */
|
||||
/** RuntimeInvisibleParameterAnnotations */
|
||||
public static final String NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "RuntimeInvisibleParameterAnnotations";
|
||||
|
||||
/** */
|
||||
/** RuntimeInvisibleTypeAnnotations */
|
||||
public static final String NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations";
|
||||
|
||||
/** RuntimeVisibleAnnotations */
|
||||
@ -205,7 +209,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code AnnotationDefault} attribute */
|
||||
public static final AttributeMapper<AnnotationDefaultAttribute>
|
||||
ANNOTATION_DEFAULT = new AbstractAttributeMapper<>(NAME_ANNOTATION_DEFAULT, Classfile.JAVA_5_VERSION) {
|
||||
ANNOTATION_DEFAULT = new AbstractAttributeMapper<>(NAME_ANNOTATION_DEFAULT) {
|
||||
@Override
|
||||
public AnnotationDefaultAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundAnnotationDefaultAttr(cf, this, p);
|
||||
@ -224,7 +228,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code BootstrapMethods} attribute */
|
||||
public static final AttributeMapper<BootstrapMethodsAttribute>
|
||||
BOOTSTRAP_METHODS = new AbstractAttributeMapper<>(NAME_BOOTSTRAP_METHODS, Classfile.JAVA_17_VERSION) {
|
||||
BOOTSTRAP_METHODS = new AbstractAttributeMapper<>(NAME_BOOTSTRAP_METHODS) {
|
||||
@Override
|
||||
public BootstrapMethodsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundBootstrapMethodsAttribute(cf, this, p);
|
||||
@ -243,7 +247,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code CharacterRangeTable} attribute */
|
||||
public static final AttributeMapper<CharacterRangeTableAttribute>
|
||||
CHARACTER_RANGE_TABLE = new AbstractAttributeMapper<>(NAME_CHARACTER_RANGE_TABLE, true, Classfile.JAVA_4_VERSION) {
|
||||
CHARACTER_RANGE_TABLE = new AbstractAttributeMapper<>(NAME_CHARACTER_RANGE_TABLE, true) {
|
||||
@Override
|
||||
public CharacterRangeTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundCharacterRangeTableAttribute(cf, this, p);
|
||||
@ -347,7 +351,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code EnclosingMethod} attribute */
|
||||
public static final AttributeMapper<EnclosingMethodAttribute>
|
||||
ENCLOSING_METHOD = new AbstractAttributeMapper<>(NAME_ENCLOSING_METHOD, Classfile.JAVA_5_VERSION) {
|
||||
ENCLOSING_METHOD = new AbstractAttributeMapper<>(NAME_ENCLOSING_METHOD) {
|
||||
@Override
|
||||
public EnclosingMethodAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundEnclosingMethodAttribute(cf, this, p);
|
||||
@ -463,7 +467,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code LocalVariableTypeTable} attribute */
|
||||
public static final AttributeMapper<LocalVariableTypeTableAttribute>
|
||||
LOCAL_VARIABLE_TYPE_TABLE = new AbstractAttributeMapper<>(NAME_LOCAL_VARIABLE_TYPE_TABLE, true, Classfile.JAVA_5_VERSION) {
|
||||
LOCAL_VARIABLE_TYPE_TABLE = new AbstractAttributeMapper<>(NAME_LOCAL_VARIABLE_TYPE_TABLE, true) {
|
||||
@Override
|
||||
public LocalVariableTypeTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundLocalVariableTypeTableAttribute(e, cf, this, p);
|
||||
@ -490,7 +494,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code MethodParameters} attribute */
|
||||
public static final AttributeMapper<MethodParametersAttribute>
|
||||
METHOD_PARAMETERS = new AbstractAttributeMapper<>(NAME_METHOD_PARAMETERS, Classfile.JAVA_8_VERSION) {
|
||||
METHOD_PARAMETERS = new AbstractAttributeMapper<>(NAME_METHOD_PARAMETERS) {
|
||||
@Override
|
||||
public MethodParametersAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundMethodParametersAttribute(cf, this, p);
|
||||
@ -514,7 +518,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code Module} attribute */
|
||||
public static final AttributeMapper<ModuleAttribute>
|
||||
MODULE = new AbstractAttributeMapper<>(NAME_MODULE, Classfile.JAVA_9_VERSION) {
|
||||
MODULE = new AbstractAttributeMapper<>(NAME_MODULE) {
|
||||
@Override
|
||||
public ModuleAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundModuleAttribute(cf, this, p);
|
||||
@ -559,7 +563,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code ModuleHashes} attribute */
|
||||
public static final AttributeMapper<ModuleHashesAttribute>
|
||||
MODULE_HASHES = new AbstractAttributeMapper<>(NAME_MODULE_HASHES, Classfile.JAVA_9_VERSION) {
|
||||
MODULE_HASHES = new AbstractAttributeMapper<>(NAME_MODULE_HASHES) {
|
||||
@Override
|
||||
public ModuleHashesAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundModuleHashesAttribute(cf, this, p);
|
||||
@ -585,7 +589,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code ModuleMainClass} attribute */
|
||||
public static final AttributeMapper<ModuleMainClassAttribute>
|
||||
MODULE_MAIN_CLASS = new AbstractAttributeMapper<>(NAME_MODULE_MAIN_CLASS, Classfile.JAVA_9_VERSION) {
|
||||
MODULE_MAIN_CLASS = new AbstractAttributeMapper<>(NAME_MODULE_MAIN_CLASS) {
|
||||
@Override
|
||||
public ModuleMainClassAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundModuleMainClassAttribute(cf, this, p);
|
||||
@ -604,7 +608,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code ModulePackages} attribute */
|
||||
public static final AttributeMapper<ModulePackagesAttribute>
|
||||
MODULE_PACKAGES = new AbstractAttributeMapper<>(NAME_MODULE_PACKAGES, Classfile.JAVA_9_VERSION) {
|
||||
MODULE_PACKAGES = new AbstractAttributeMapper<>(NAME_MODULE_PACKAGES) {
|
||||
@Override
|
||||
public ModulePackagesAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundModulePackagesAttribute(cf, this, p);
|
||||
@ -623,7 +627,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code ModuleResolution} attribute */
|
||||
public static final AttributeMapper<ModuleResolutionAttribute>
|
||||
MODULE_RESOLUTION = new AbstractAttributeMapper<>(NAME_MODULE_RESOLUTION, Classfile.JAVA_9_VERSION) {
|
||||
MODULE_RESOLUTION = new AbstractAttributeMapper<>(NAME_MODULE_RESOLUTION) {
|
||||
@Override
|
||||
public ModuleResolutionAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundModuleResolutionAttribute(cf, this, p);
|
||||
@ -642,7 +646,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code ModuleTarget} attribute */
|
||||
public static final AttributeMapper<ModuleTargetAttribute>
|
||||
MODULE_TARGET = new AbstractAttributeMapper<>(NAME_MODULE_TARGET, Classfile.JAVA_9_VERSION) {
|
||||
MODULE_TARGET = new AbstractAttributeMapper<>(NAME_MODULE_TARGET) {
|
||||
@Override
|
||||
public ModuleTargetAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundModuleTargetAttribute(cf, this, p);
|
||||
@ -661,7 +665,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code NestHost} attribute */
|
||||
public static final AttributeMapper<NestHostAttribute>
|
||||
NEST_HOST = new AbstractAttributeMapper<>(NAME_NEST_HOST, Classfile.JAVA_11_VERSION) {
|
||||
NEST_HOST = new AbstractAttributeMapper<>(NAME_NEST_HOST) {
|
||||
@Override
|
||||
public NestHostAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundNestHostAttribute(cf, this, p);
|
||||
@ -680,7 +684,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code NestMembers} attribute */
|
||||
public static final AttributeMapper<NestMembersAttribute>
|
||||
NEST_MEMBERS = new AbstractAttributeMapper<>(NAME_NEST_MEMBERS, Classfile.JAVA_11_VERSION) {
|
||||
NEST_MEMBERS = new AbstractAttributeMapper<>(NAME_NEST_MEMBERS) {
|
||||
@Override
|
||||
public NestMembersAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundNestMembersAttribute(cf, this, p);
|
||||
@ -699,7 +703,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code PermittedSubclasses} attribute */
|
||||
public static final AttributeMapper<PermittedSubclassesAttribute>
|
||||
PERMITTED_SUBCLASSES = new AbstractAttributeMapper<>(NAME_PERMITTED_SUBCLASSES, Classfile.JAVA_15_VERSION) {
|
||||
PERMITTED_SUBCLASSES = new AbstractAttributeMapper<>(NAME_PERMITTED_SUBCLASSES) {
|
||||
@Override
|
||||
public PermittedSubclassesAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundPermittedSubclassesAttribute(cf, this, p);
|
||||
@ -718,7 +722,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code Record} attribute */
|
||||
public static final AttributeMapper<RecordAttribute>
|
||||
RECORD = new AbstractAttributeMapper<>(NAME_RECORD, Classfile.JAVA_16_VERSION) {
|
||||
RECORD = new AbstractAttributeMapper<>(NAME_RECORD) {
|
||||
@Override
|
||||
public RecordAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundRecordAttribute(cf, this, p);
|
||||
@ -743,7 +747,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code RuntimeInvisibleAnnotations} attribute */
|
||||
public static final AttributeMapper<RuntimeInvisibleAnnotationsAttribute>
|
||||
RUNTIME_INVISIBLE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
|
||||
RUNTIME_INVISIBLE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_ANNOTATIONS) {
|
||||
@Override
|
||||
public RuntimeInvisibleAnnotationsAttribute readAttribute(AttributedElement enclosing, ClassReader cf, int pos) {
|
||||
return new BoundAttribute.BoundRuntimeInvisibleAnnotationsAttribute(cf, pos);
|
||||
@ -762,7 +766,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code RuntimeInvisibleParameterAnnotations} attribute */
|
||||
public static final AttributeMapper<RuntimeInvisibleParameterAnnotationsAttribute>
|
||||
RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
|
||||
RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS) {
|
||||
@Override
|
||||
public RuntimeInvisibleParameterAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundRuntimeInvisibleParameterAnnotationsAttribute(cf, this, p);
|
||||
@ -784,7 +788,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code RuntimeInvisibleTypeAnnotations} attribute */
|
||||
public static final AttributeMapper<RuntimeInvisibleTypeAnnotationsAttribute>
|
||||
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS, Classfile.JAVA_8_VERSION) {
|
||||
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS) {
|
||||
@Override
|
||||
public RuntimeInvisibleTypeAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundRuntimeInvisibleTypeAnnotationsAttribute(e, cf, this, p);
|
||||
@ -803,7 +807,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code RuntimeVisibleAnnotations} attribute */
|
||||
public static final AttributeMapper<RuntimeVisibleAnnotationsAttribute>
|
||||
RUNTIME_VISIBLE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
|
||||
RUNTIME_VISIBLE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_ANNOTATIONS) {
|
||||
@Override
|
||||
public RuntimeVisibleAnnotationsAttribute readAttribute(AttributedElement enclosing, ClassReader cf, int pos) {
|
||||
return new BoundAttribute.BoundRuntimeVisibleAnnotationsAttribute(cf, pos);
|
||||
@ -822,7 +826,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code RuntimeVisibleParameterAnnotations} attribute */
|
||||
public static final AttributeMapper<RuntimeVisibleParameterAnnotationsAttribute>
|
||||
RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
|
||||
RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS) {
|
||||
@Override
|
||||
public RuntimeVisibleParameterAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundRuntimeVisibleParameterAnnotationsAttribute(cf, this, p);
|
||||
@ -844,7 +848,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code RuntimeVisibleTypeAnnotations} attribute */
|
||||
public static final AttributeMapper<RuntimeVisibleTypeAnnotationsAttribute>
|
||||
RUNTIME_VISIBLE_TYPE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS, Classfile.JAVA_8_VERSION) {
|
||||
RUNTIME_VISIBLE_TYPE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS) {
|
||||
@Override
|
||||
public RuntimeVisibleTypeAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundRuntimeVisibleTypeAnnotationsAttribute(e, cf, this, p);
|
||||
@ -863,7 +867,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code Signature} attribute */
|
||||
public static final AttributeMapper<SignatureAttribute>
|
||||
SIGNATURE = new AbstractAttributeMapper<>(NAME_SIGNATURE, Classfile.JAVA_5_VERSION) {
|
||||
SIGNATURE = new AbstractAttributeMapper<>(NAME_SIGNATURE) {
|
||||
@Override
|
||||
public SignatureAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundSignatureAttribute(cf, this, p);
|
||||
@ -882,7 +886,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code SourceDebugExtension} attribute */
|
||||
public static final AttributeMapper<SourceDebugExtensionAttribute>
|
||||
SOURCE_DEBUG_EXTENSION = new AbstractAttributeMapper<>(NAME_SOURCE_DEBUG_EXTENSION, Classfile.JAVA_5_VERSION) {
|
||||
SOURCE_DEBUG_EXTENSION = new AbstractAttributeMapper<>(NAME_SOURCE_DEBUG_EXTENSION) {
|
||||
@Override
|
||||
public SourceDebugExtensionAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundSourceDebugExtensionAttribute(cf, this, p);
|
||||
@ -939,7 +943,7 @@ public class Attributes {
|
||||
|
||||
/** Attribute mapper for the {@code StackMapTable} attribute */
|
||||
public static final AttributeMapper<StackMapTableAttribute>
|
||||
STACK_MAP_TABLE = new AbstractAttributeMapper<>(NAME_STACK_MAP_TABLE, Classfile.JAVA_6_VERSION) {
|
||||
STACK_MAP_TABLE = new AbstractAttributeMapper<>(NAME_STACK_MAP_TABLE) {
|
||||
@Override
|
||||
public StackMapTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
|
||||
return new BoundAttribute.BoundStackMapTableAttribute((CodeImpl)e, cf, this, p);
|
@ -23,21 +23,25 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ConstantPool;
|
||||
import jdk.internal.classfile.constantpool.LoadableConstantEntry;
|
||||
import jdk.internal.classfile.constantpool.MethodHandleEntry;
|
||||
import java.lang.classfile.constantpool.ConstantPool;
|
||||
import java.lang.classfile.constantpool.LoadableConstantEntry;
|
||||
import java.lang.classfile.constantpool.MethodHandleEntry;
|
||||
import jdk.internal.classfile.impl.BootstrapMethodEntryImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models an entry in the bootstrap method table. The bootstrap method table
|
||||
* is stored in the {@code BootstrapMethods} attribute, but is modeled by
|
||||
* the {@link ConstantPool}, since the bootstrap method table is logically
|
||||
* part of the constant pool.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface BootstrapMethodEntry
|
||||
extends WritableElement<BootstrapMethodEntry>
|
||||
permits BootstrapMethodEntryImpl {
|
@ -22,21 +22,25 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ConstantPool;
|
||||
import jdk.internal.classfile.constantpool.ConstantPoolBuilder;
|
||||
import jdk.internal.classfile.constantpool.PoolEntry;
|
||||
import java.lang.classfile.constantpool.ConstantPool;
|
||||
import java.lang.classfile.constantpool.ConstantPoolBuilder;
|
||||
import java.lang.classfile.constantpool.PoolEntry;
|
||||
import jdk.internal.classfile.impl.BufWriterImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Supports writing portions of a classfile to a growable buffer. Method
|
||||
* Supports writing portions of a classfile to a growable buffer. Methods
|
||||
* are provided to write various standard entities (e.g., {@code u2}, {@code u4})
|
||||
* to the end of the buffer, as well as to create constant pool entries.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface BufWriter
|
||||
permits BufWriterImpl {
|
||||
|
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
@ -33,25 +33,29 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.ChainedClassBuilder;
|
||||
import jdk.internal.classfile.impl.DirectClassBuilder;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
import jdk.internal.classfile.attribute.CodeAttribute;
|
||||
import java.lang.classfile.attribute.CodeAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A builder for classfiles. Builders are not created directly; they are passed
|
||||
* to handlers by methods such as {@link Classfile#build(ClassDesc, Consumer)}
|
||||
* to handlers by methods such as {@link ClassFile#build(ClassDesc, Consumer)}
|
||||
* or to class transforms. The elements of a classfile can be specified
|
||||
* abstractly (by passing a {@link ClassElement} to {@link #with(ClassfileElement)})
|
||||
* abstractly (by passing a {@link ClassElement} to {@link #with(ClassFileElement)})
|
||||
* or concretely by calling the various {@code withXxx} methods.
|
||||
*
|
||||
* @see ClassTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassBuilder
|
||||
extends ClassfileBuilder<ClassElement, ClassBuilder>
|
||||
extends ClassFileBuilder<ClassElement, ClassBuilder>
|
||||
permits ChainedClassBuilder, DirectClassBuilder {
|
||||
|
||||
/**
|
||||
@ -67,7 +71,7 @@ public sealed interface ClassBuilder
|
||||
* @return this builder
|
||||
*/
|
||||
default ClassBuilder withVersion(int major, int minor) {
|
||||
return with(ClassfileVersion.of(major, minor));
|
||||
return with(ClassFileVersion.of(major, minor));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,6 +105,7 @@ public sealed interface ClassBuilder
|
||||
* Sets the superclass of this class.
|
||||
* @param desc the superclass
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code desc} represents a primitive type
|
||||
*/
|
||||
default ClassBuilder withSuperclass(ClassDesc desc) {
|
||||
return withSuperclass(constantPool().classEntry(desc));
|
@ -22,39 +22,44 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.attribute.CompilationIDAttribute;
|
||||
import jdk.internal.classfile.attribute.DeprecatedAttribute;
|
||||
import jdk.internal.classfile.attribute.EnclosingMethodAttribute;
|
||||
import jdk.internal.classfile.attribute.InnerClassesAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleHashesAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleMainClassAttribute;
|
||||
import jdk.internal.classfile.attribute.ModulePackagesAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleResolutionAttribute;
|
||||
import jdk.internal.classfile.attribute.ModuleTargetAttribute;
|
||||
import jdk.internal.classfile.attribute.NestHostAttribute;
|
||||
import jdk.internal.classfile.attribute.NestMembersAttribute;
|
||||
import jdk.internal.classfile.attribute.PermittedSubclassesAttribute;
|
||||
import jdk.internal.classfile.attribute.RecordAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.SignatureAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceDebugExtensionAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceFileAttribute;
|
||||
import jdk.internal.classfile.attribute.SourceIDAttribute;
|
||||
import jdk.internal.classfile.attribute.SyntheticAttribute;
|
||||
import jdk.internal.classfile.attribute.UnknownAttribute;
|
||||
import java.lang.classfile.attribute.CompilationIDAttribute;
|
||||
import java.lang.classfile.attribute.DeprecatedAttribute;
|
||||
import java.lang.classfile.attribute.EnclosingMethodAttribute;
|
||||
import java.lang.classfile.attribute.InnerClassesAttribute;
|
||||
import java.lang.classfile.attribute.ModuleAttribute;
|
||||
import java.lang.classfile.attribute.ModuleHashesAttribute;
|
||||
import java.lang.classfile.attribute.ModuleMainClassAttribute;
|
||||
import java.lang.classfile.attribute.ModulePackagesAttribute;
|
||||
import java.lang.classfile.attribute.ModuleResolutionAttribute;
|
||||
import java.lang.classfile.attribute.ModuleTargetAttribute;
|
||||
import java.lang.classfile.attribute.NestHostAttribute;
|
||||
import java.lang.classfile.attribute.NestMembersAttribute;
|
||||
import java.lang.classfile.attribute.PermittedSubclassesAttribute;
|
||||
import java.lang.classfile.attribute.RecordAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.SignatureAttribute;
|
||||
import java.lang.classfile.attribute.SourceDebugExtensionAttribute;
|
||||
import java.lang.classfile.attribute.SourceFileAttribute;
|
||||
import java.lang.classfile.attribute.SourceIDAttribute;
|
||||
import java.lang.classfile.attribute.SyntheticAttribute;
|
||||
import java.lang.classfile.attribute.UnknownAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A {@link ClassfileElement} that can appear when traversing the elements
|
||||
* of a {@link ClassModel} or be presented to a {@link ClassBuilder}.
|
||||
* A marker interface for elements that can appear when traversing
|
||||
* a {@link ClassModel} or be presented to a {@link ClassBuilder}.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface ClassElement extends ClassfileElement
|
||||
permits AccessFlags, Superclass, Interfaces, ClassfileVersion,
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassElement extends ClassFileElement
|
||||
permits AccessFlags, Superclass, Interfaces, ClassFileVersion,
|
||||
FieldModel, MethodModel,
|
||||
CustomAttribute, CompilationIDAttribute, DeprecatedAttribute,
|
||||
EnclosingMethodAttribute, InnerClassesAttribute,
|
File diff suppressed because it is too large
Load Diff
@ -22,31 +22,36 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ConstantPool;
|
||||
import jdk.internal.classfile.constantpool.ConstantPoolBuilder;
|
||||
import java.lang.classfile.constantpool.ConstantPool;
|
||||
import java.lang.classfile.constantpool.ConstantPoolBuilder;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A builder for a classfile or portion of a classfile. Builders are rarely
|
||||
* created directly; they are passed to handlers by methods such as
|
||||
* {@link Classfile#build(ClassDesc, Consumer)} or to transforms.
|
||||
* {@link ClassFile#build(ClassDesc, Consumer)} or to transforms.
|
||||
* Elements of the newly built entity can be specified
|
||||
* abstractly (by passing a {@link ClassfileElement} to {@link #with(ClassfileElement)}
|
||||
* abstractly (by passing a {@link ClassFileElement} to {@link #with(ClassFileElement)}
|
||||
* or concretely by calling the various {@code withXxx} methods.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param <B> the builder type
|
||||
* @see ClassfileTransform
|
||||
* @see ClassFileTransform
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface ClassfileBuilder<E extends ClassfileElement, B extends ClassfileBuilder<E, B>>
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassFileBuilder<E extends ClassFileElement, B extends ClassFileBuilder<E, B>>
|
||||
extends Consumer<E> permits ClassBuilder, FieldBuilder, MethodBuilder, CodeBuilder {
|
||||
|
||||
/**
|
||||
* Integrate the {@link ClassfileElement} into the entity being built.
|
||||
* Integrate the {@link ClassFileElement} into the entity being built.
|
||||
* @param e the element
|
||||
*/
|
||||
@Override
|
||||
@ -55,7 +60,7 @@ public sealed interface ClassfileBuilder<E extends ClassfileElement, B extends C
|
||||
}
|
||||
|
||||
/**
|
||||
* Integrate the {@link ClassfileElement} into the entity being built.
|
||||
* Integrate the {@link ClassFileElement} into the entity being built.
|
||||
* @param e the element
|
||||
* @return this builder
|
||||
*/
|
||||
@ -79,7 +84,7 @@ public sealed interface ClassfileBuilder<E extends ClassfileElement, B extends C
|
||||
* @param model the model to transform
|
||||
* @param transform the transform to apply
|
||||
*/
|
||||
default void transform(CompoundElement<E> model, ClassfileTransform<?, E, B> transform) {
|
||||
default void transform(CompoundElement<E> model, ClassFileTransform<?, E, B> transform) {
|
||||
@SuppressWarnings("unchecked")
|
||||
B builder = (B) this;
|
||||
var resolved = transform.resolve(builder);
|
@ -22,7 +22,9 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Immutable model for a portion of (or the entirety of) a classfile. Elements
|
||||
@ -31,8 +33,12 @@ package jdk.internal.classfile;
|
||||
* themselves contain their own child elements will implement {@link
|
||||
* CompoundElement}. Elements specific to various locations in the classfile
|
||||
* will implement {@link ClassElement}, {@link MethodElement}, etc.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface ClassfileElement
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassFileElement
|
||||
permits AttributedElement, CompoundElement, WritableElement,
|
||||
ClassElement, CodeElement, FieldElement, MethodElement {
|
||||
}
|
@ -22,33 +22,34 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A transformation on streams of elements. Transforms are used during
|
||||
* transformation of classfile entities; a transform is provided to a method like
|
||||
* {@link Classfile#transform(ClassModel, ClassTransform)}, and the elements of the class,
|
||||
* {@link ClassFile#transform(ClassModel, ClassTransform)}, and the elements of the class,
|
||||
* along with a builder, are presented to the transform.
|
||||
*
|
||||
* <p>The subtypes of {@linkplain
|
||||
* ClassfileTransform} (e.g., {@link ClassTransform}) are functional interfaces
|
||||
* ClassFileTransform} (e.g., {@link ClassTransform}) are functional interfaces
|
||||
* that accept an element and a corresponding builder. Since any element can be
|
||||
* reproduced on the builder via {@link ClassBuilder#with(ClassfileElement)}, a
|
||||
* reproduced on the builder via {@link ClassBuilder#with(ClassFileElement)}, a
|
||||
* transform can easily leave elements in place, remove them, replace them, or
|
||||
* augment them with other elements. This enables localized transforms to be
|
||||
* represented concisely.
|
||||
*
|
||||
* <p>Transforms also have an {@link #atEnd(ClassfileBuilder)} method, for
|
||||
* <p>Transforms also have an {@link #atEnd(ClassFileBuilder)} method, for
|
||||
* which the default implementation does nothing, so that a transform can
|
||||
* perform additional building after the stream of elements is exhausted.
|
||||
*
|
||||
* <p>Transforms can be chained together via the {@link
|
||||
* #andThen(ClassfileTransform)} method, so that the output of one becomes the
|
||||
* #andThen(ClassFileTransform)} method, so that the output of one becomes the
|
||||
* input to another. This allows smaller units of transformation to be captured
|
||||
* and reused.
|
||||
*
|
||||
@ -56,7 +57,7 @@ import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
* annotation on a class may watch for the {@link RuntimeVisibleAnnotationsAttribute}
|
||||
* element and transform it if found, but if it is not found, will generate a
|
||||
* {@linkplain RuntimeVisibleAnnotationsAttribute} element containing the
|
||||
* injected annotation from the {@linkplain #atEnd(ClassfileBuilder)} handler.
|
||||
* injected annotation from the {@linkplain #atEnd(ClassFileBuilder)} handler.
|
||||
* To do this, the transform must accumulate some state during the traversal so
|
||||
* that the end handler knows what to do. If such a transform is to be reused,
|
||||
* its state must be reset for each traversal; this will happen automatically if
|
||||
@ -71,17 +72,21 @@ import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
* @param <C> the transform type
|
||||
* @param <E> the element type
|
||||
* @param <B> the builder type
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface ClassfileTransform<
|
||||
C extends ClassfileTransform<C, E, B>,
|
||||
E extends ClassfileElement,
|
||||
B extends ClassfileBuilder<E, B>>
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassFileTransform<
|
||||
C extends ClassFileTransform<C, E, B>,
|
||||
E extends ClassFileElement,
|
||||
B extends ClassFileBuilder<E, B>>
|
||||
permits ClassTransform, FieldTransform, MethodTransform, CodeTransform {
|
||||
/**
|
||||
* Transform an element by taking the appropriate actions on the builder.
|
||||
* Used when transforming a classfile entity (class, method, field, method
|
||||
* body.) If no transformation is desired, the element can be presented to
|
||||
* {@link B#with(ClassfileElement)}. If the element is to be dropped, no
|
||||
* {@link B#with(ClassFileElement)}. If the element is to be dropped, no
|
||||
* action is required.
|
||||
*
|
||||
* @param builder the builder for the new entity
|
||||
@ -92,7 +97,7 @@ public sealed interface ClassfileTransform<
|
||||
/**
|
||||
* Take any final action during transformation of a classfile entity. Called
|
||||
* after all elements of the class are presented to {@link
|
||||
* #accept(ClassfileBuilder, ClassfileElement)}.
|
||||
* #accept(ClassFileBuilder, ClassFileElement)}.
|
||||
*
|
||||
* @param builder the builder for the new entity
|
||||
* @implSpec The default implementation does nothing.
|
||||
@ -103,7 +108,7 @@ public sealed interface ClassfileTransform<
|
||||
/**
|
||||
* Take any preliminary action during transformation of a classfile entity.
|
||||
* Called before any elements of the class are presented to {@link
|
||||
* #accept(ClassfileBuilder, ClassfileElement)}.
|
||||
* #accept(ClassFileBuilder, ClassFileElement)}.
|
||||
*
|
||||
* @param builder the builder for the new entity
|
||||
* @implSpec The default implementation does nothing.
|
||||
@ -125,8 +130,11 @@ public sealed interface ClassfileTransform<
|
||||
* the implementation to perform transformation.
|
||||
*
|
||||
* @param <E> the element type
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
interface ResolvedTransform<E extends ClassfileElement> {
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
interface ResolvedTransform<E extends ClassFileElement> {
|
||||
/**
|
||||
* {@return a {@link Consumer} to receive elements}
|
||||
*/
|
||||
@ -151,7 +159,7 @@ public sealed interface ClassfileTransform<
|
||||
*
|
||||
* <p>This method is a low-level method that should rarely be used by
|
||||
* user code; most of the time, user code should prefer
|
||||
* {@link ClassfileBuilder#transform(CompoundElement, ClassfileTransform)},
|
||||
* {@link ClassFileBuilder#transform(CompoundElement, ClassFileTransform)},
|
||||
* which resolves the transform and executes it on the current builder.
|
||||
*
|
||||
* @param builder the builder to bind to
|
@ -22,18 +22,22 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.impl.ClassfileVersionImpl;
|
||||
import jdk.internal.classfile.impl.ClassFileVersionImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the classfile version information for a class. Delivered as a {@link
|
||||
* jdk.internal.classfile.ClassElement} when traversing the elements of a {@link
|
||||
* java.lang.classfile.ClassElement} when traversing the elements of a {@link
|
||||
* ClassModel}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface ClassfileVersion
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassFileVersion
|
||||
extends ClassElement
|
||||
permits ClassfileVersionImpl {
|
||||
permits ClassFileVersionImpl {
|
||||
/**
|
||||
* {@return the major classfile version}
|
||||
*/
|
||||
@ -45,11 +49,11 @@ public sealed interface ClassfileVersion
|
||||
int minorVersion();
|
||||
|
||||
/**
|
||||
* {@return a {@link ClassfileVersion} element}
|
||||
* {@return a {@link ClassFileVersion} element}
|
||||
* @param majorVersion the major classfile version
|
||||
* @param minorVersion the minor classfile version
|
||||
*/
|
||||
static ClassfileVersion of(int majorVersion, int minorVersion) {
|
||||
return new ClassfileVersionImpl(majorVersion, minorVersion);
|
||||
static ClassFileVersion of(int majorVersion, int minorVersion) {
|
||||
return new ClassFileVersionImpl(majorVersion, minorVersion);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.constant.ClassDesc;
|
||||
@ -39,11 +39,15 @@ import jdk.internal.classfile.impl.ClassHierarchyImpl.StaticClassHierarchyResolv
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
|
||||
import static java.lang.constant.ConstantDescs.CD_Object;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Provides class hierarchy information for generating correct stack maps
|
||||
* during code building.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
@FunctionalInterface
|
||||
public interface ClassHierarchyResolver {
|
||||
|
||||
@ -65,7 +69,10 @@ public interface ClassHierarchyResolver {
|
||||
|
||||
/**
|
||||
* Information about a resolved class.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface ClassHierarchyInfo permits ClassHierarchyImpl.ClassHierarchyInfoImpl {
|
||||
|
||||
/**
|
||||
@ -94,6 +101,9 @@ public interface ClassHierarchyResolver {
|
||||
*
|
||||
* @param other the other resolver
|
||||
* @return the chained resolver
|
||||
*
|
||||
* @implSpec The default implementation returns resolver implemented to ask
|
||||
* other resolver in cases where this resolver returns {@code null}.
|
||||
*/
|
||||
default ClassHierarchyResolver orElse(ClassHierarchyResolver other) {
|
||||
return new ClassHierarchyResolver() {
|
||||
@ -115,6 +125,12 @@ public interface ClassHierarchyResolver {
|
||||
*
|
||||
* @param cacheFactory the factory for the cache
|
||||
* @return the ClassHierarchyResolver with caching
|
||||
*
|
||||
* @implSpec The default implementation returns resolver holding an instance
|
||||
* of the cache map provided by the {@code cacheFactory}. It asks
|
||||
* the cache map always first and fills the cache map with all
|
||||
* resolved and also unresolved class info. The cache map may refuse
|
||||
* {@code null} keys and values.
|
||||
*/
|
||||
default ClassHierarchyResolver cached(Supplier<Map<ClassDesc, ClassHierarchyInfo>> cacheFactory) {
|
||||
return new ClassHierarchyImpl.CachedClassHierarchyResolver(this, cacheFactory.get());
|
||||
@ -127,6 +143,9 @@ public interface ClassHierarchyResolver {
|
||||
* {@snippet file="PackageSnippets.java" region="lookup-class-hierarchy-resolver"}
|
||||
*
|
||||
* @return the ClassHierarchyResolver
|
||||
*
|
||||
* @implSpec The default implementation calls {@link #cached(Supplier)} with
|
||||
* {@link HashMap} supplier as {@code cacheFactory}.
|
||||
*/
|
||||
default ClassHierarchyResolver cached() {
|
||||
record Factory() implements Supplier<Map<ClassDesc, ClassHierarchyInfo>> {
|
@ -23,22 +23,26 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.constantpool.ConstantPool;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.ConstantPool;
|
||||
import jdk.internal.classfile.impl.ClassImpl;
|
||||
import jdk.internal.classfile.impl.verifier.VerifierImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a classfile. The contents of the classfile can be traversed via
|
||||
* a streaming view (e.g., {@link #elements()}), or via random access (e.g.,
|
||||
* {@link #flags()}), or by freely mixing the two.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassModel
|
||||
extends CompoundElement<ClassElement>, AttributedElement
|
||||
permits ClassImpl {
|
@ -22,21 +22,22 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.constantpool.ConstantPool;
|
||||
import jdk.internal.classfile.constantpool.ConstantPoolException;
|
||||
import jdk.internal.classfile.constantpool.MethodHandleEntry;
|
||||
import jdk.internal.classfile.constantpool.ModuleEntry;
|
||||
import jdk.internal.classfile.constantpool.NameAndTypeEntry;
|
||||
import jdk.internal.classfile.constantpool.PackageEntry;
|
||||
import jdk.internal.classfile.constantpool.PoolEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.ConstantPool;
|
||||
import java.lang.classfile.constantpool.ConstantPoolException;
|
||||
import java.lang.classfile.constantpool.MethodHandleEntry;
|
||||
import java.lang.classfile.constantpool.ModuleEntry;
|
||||
import java.lang.classfile.constantpool.NameAndTypeEntry;
|
||||
import java.lang.classfile.constantpool.PackageEntry;
|
||||
import java.lang.classfile.constantpool.PoolEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.ClassReaderImpl;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Supports reading from a classfile. Methods are provided to read data of
|
||||
@ -44,7 +45,10 @@ import java.util.function.Function;
|
||||
* the classfile, copying raw bytes, and reading constant pool entries.
|
||||
* Encapsulates additional reading context such as mappers for custom attributes
|
||||
* and processing options.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassReader extends ConstantPool
|
||||
permits ClassReaderImpl {
|
||||
|
||||
@ -52,7 +56,7 @@ public sealed interface ClassReader extends ConstantPool
|
||||
|
||||
/**
|
||||
* {@return the table of custom attribute mappers} This is derived from
|
||||
* the processing option {@link Classfile.AttributeMapperOption}.
|
||||
* the processing option {@link ClassFile.AttributeMapperOption}.
|
||||
*/
|
||||
Function<Utf8Entry, AttributeMapper<?>> customAttributes();
|
||||
|
||||
@ -105,6 +109,7 @@ public sealed interface ClassReader extends ConstantPool
|
||||
/**
|
||||
* {@return the constant pool entry of a given type whose index is given
|
||||
* at the specified offset within the classfile}
|
||||
* @param <T> the entry type
|
||||
* @param offset the offset of the index within the classfile
|
||||
* @param cls the entry type
|
||||
* @throws ConstantPoolException if the index is out of range of the
|
@ -22,15 +22,19 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.List;
|
||||
import jdk.internal.classfile.impl.SignaturesImpl;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the generic signature of a class file, as defined by {@jvms 4.7.9}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassSignature
|
||||
permits SignaturesImpl.ClassSignatureImpl {
|
||||
|
||||
@ -47,7 +51,7 @@ public sealed interface ClassSignature
|
||||
String signatureString();
|
||||
|
||||
/**
|
||||
* @return class signature
|
||||
* {@return a class signature}
|
||||
* @param superclassSignature the superclass
|
||||
* @param superinterfaceSignatures the interfaces
|
||||
*/
|
||||
@ -57,7 +61,7 @@ public sealed interface ClassSignature
|
||||
}
|
||||
|
||||
/**
|
||||
* @return class signature
|
||||
* {@return a class signature}
|
||||
* @param typeParameters the type parameters
|
||||
* @param superclassSignature the superclass
|
||||
* @param superinterfaceSignatures the interfaces
|
@ -22,23 +22,27 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import jdk.internal.classfile.attribute.CodeAttribute;
|
||||
import java.lang.classfile.attribute.CodeAttribute;
|
||||
import jdk.internal.classfile.impl.TransformImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A transformation on streams of {@link ClassElement}.
|
||||
*
|
||||
* @see ClassfileTransform
|
||||
* @see ClassFileTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
@FunctionalInterface
|
||||
public non-sealed interface ClassTransform
|
||||
extends ClassfileTransform<ClassTransform, ClassElement, ClassBuilder> {
|
||||
extends ClassFileTransform<ClassTransform, ClassElement, ClassBuilder> {
|
||||
|
||||
/**
|
||||
* A class transform that sends all elements to the builder.
|
||||
@ -156,11 +160,22 @@ public non-sealed interface ClassTransform
|
||||
return new TransformImpl.ClassFieldTransform(xform, f -> true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec
|
||||
* The default implementation returns this class transform chained with another
|
||||
* class transform from the argument. Chaining of two transforms requires to
|
||||
* involve a chained builder serving as a target builder for this transform
|
||||
* and also as a source of elements for the downstream transform.
|
||||
*/
|
||||
@Override
|
||||
default ClassTransform andThen(ClassTransform t) {
|
||||
return new TransformImpl.ChainedClassTransform(this, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec The default implementation returns a resolved transform bound
|
||||
* to the given class builder.
|
||||
*/
|
||||
@Override
|
||||
default ResolvedTransform<ClassElement> resolve(ClassBuilder builder) {
|
||||
return new TransformImpl.ResolvedTransformImpl<>(e -> accept(builder, e),
|
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.lang.constant.ConstantDesc;
|
||||
@ -36,16 +36,16 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.constantpool.FieldRefEntry;
|
||||
import jdk.internal.classfile.constantpool.InterfaceMethodRefEntry;
|
||||
import jdk.internal.classfile.constantpool.InvokeDynamicEntry;
|
||||
import jdk.internal.classfile.constantpool.LoadableConstantEntry;
|
||||
import jdk.internal.classfile.constantpool.MemberRefEntry;
|
||||
import jdk.internal.classfile.constantpool.MethodRefEntry;
|
||||
import jdk.internal.classfile.constantpool.MethodHandleEntry;
|
||||
import jdk.internal.classfile.constantpool.NameAndTypeEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.FieldRefEntry;
|
||||
import java.lang.classfile.constantpool.InterfaceMethodRefEntry;
|
||||
import java.lang.classfile.constantpool.InvokeDynamicEntry;
|
||||
import java.lang.classfile.constantpool.LoadableConstantEntry;
|
||||
import java.lang.classfile.constantpool.MemberRefEntry;
|
||||
import java.lang.classfile.constantpool.MethodRefEntry;
|
||||
import java.lang.classfile.constantpool.MethodHandleEntry;
|
||||
import java.lang.classfile.constantpool.NameAndTypeEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BlockCodeBuilderImpl;
|
||||
import jdk.internal.classfile.impl.BytecodeHelpers;
|
||||
import jdk.internal.classfile.impl.CatchBuilderImpl;
|
||||
@ -53,53 +53,57 @@ import jdk.internal.classfile.impl.ChainedCodeBuilder;
|
||||
import jdk.internal.classfile.impl.LabelImpl;
|
||||
import jdk.internal.classfile.impl.NonterminalCodeBuilder;
|
||||
import jdk.internal.classfile.impl.TerminalCodeBuilder;
|
||||
import jdk.internal.classfile.instruction.ArrayLoadInstruction;
|
||||
import jdk.internal.classfile.instruction.ArrayStoreInstruction;
|
||||
import jdk.internal.classfile.instruction.BranchInstruction;
|
||||
import jdk.internal.classfile.instruction.CharacterRange;
|
||||
import jdk.internal.classfile.instruction.ConstantInstruction;
|
||||
import jdk.internal.classfile.instruction.ConvertInstruction;
|
||||
import jdk.internal.classfile.instruction.ExceptionCatch;
|
||||
import jdk.internal.classfile.instruction.FieldInstruction;
|
||||
import jdk.internal.classfile.instruction.IncrementInstruction;
|
||||
import jdk.internal.classfile.instruction.InvokeDynamicInstruction;
|
||||
import jdk.internal.classfile.instruction.InvokeInstruction;
|
||||
import jdk.internal.classfile.instruction.LineNumber;
|
||||
import jdk.internal.classfile.instruction.LoadInstruction;
|
||||
import jdk.internal.classfile.instruction.LocalVariable;
|
||||
import jdk.internal.classfile.instruction.LocalVariableType;
|
||||
import jdk.internal.classfile.instruction.LookupSwitchInstruction;
|
||||
import jdk.internal.classfile.instruction.MonitorInstruction;
|
||||
import jdk.internal.classfile.instruction.NewMultiArrayInstruction;
|
||||
import jdk.internal.classfile.instruction.NewObjectInstruction;
|
||||
import jdk.internal.classfile.instruction.NewPrimitiveArrayInstruction;
|
||||
import jdk.internal.classfile.instruction.NewReferenceArrayInstruction;
|
||||
import jdk.internal.classfile.instruction.NopInstruction;
|
||||
import jdk.internal.classfile.instruction.OperatorInstruction;
|
||||
import jdk.internal.classfile.instruction.ReturnInstruction;
|
||||
import jdk.internal.classfile.instruction.StackInstruction;
|
||||
import jdk.internal.classfile.instruction.StoreInstruction;
|
||||
import jdk.internal.classfile.instruction.SwitchCase;
|
||||
import jdk.internal.classfile.instruction.TableSwitchInstruction;
|
||||
import jdk.internal.classfile.instruction.ThrowInstruction;
|
||||
import jdk.internal.classfile.instruction.TypeCheckInstruction;
|
||||
import java.lang.classfile.instruction.ArrayLoadInstruction;
|
||||
import java.lang.classfile.instruction.ArrayStoreInstruction;
|
||||
import java.lang.classfile.instruction.BranchInstruction;
|
||||
import java.lang.classfile.instruction.CharacterRange;
|
||||
import java.lang.classfile.instruction.ConstantInstruction;
|
||||
import java.lang.classfile.instruction.ConvertInstruction;
|
||||
import java.lang.classfile.instruction.ExceptionCatch;
|
||||
import java.lang.classfile.instruction.FieldInstruction;
|
||||
import java.lang.classfile.instruction.IncrementInstruction;
|
||||
import java.lang.classfile.instruction.InvokeDynamicInstruction;
|
||||
import java.lang.classfile.instruction.InvokeInstruction;
|
||||
import java.lang.classfile.instruction.LineNumber;
|
||||
import java.lang.classfile.instruction.LoadInstruction;
|
||||
import java.lang.classfile.instruction.LocalVariable;
|
||||
import java.lang.classfile.instruction.LocalVariableType;
|
||||
import java.lang.classfile.instruction.LookupSwitchInstruction;
|
||||
import java.lang.classfile.instruction.MonitorInstruction;
|
||||
import java.lang.classfile.instruction.NewMultiArrayInstruction;
|
||||
import java.lang.classfile.instruction.NewObjectInstruction;
|
||||
import java.lang.classfile.instruction.NewPrimitiveArrayInstruction;
|
||||
import java.lang.classfile.instruction.NewReferenceArrayInstruction;
|
||||
import java.lang.classfile.instruction.NopInstruction;
|
||||
import java.lang.classfile.instruction.OperatorInstruction;
|
||||
import java.lang.classfile.instruction.ReturnInstruction;
|
||||
import java.lang.classfile.instruction.StackInstruction;
|
||||
import java.lang.classfile.instruction.StoreInstruction;
|
||||
import java.lang.classfile.instruction.SwitchCase;
|
||||
import java.lang.classfile.instruction.TableSwitchInstruction;
|
||||
import java.lang.classfile.instruction.ThrowInstruction;
|
||||
import java.lang.classfile.instruction.TypeCheckInstruction;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static jdk.internal.classfile.impl.BytecodeHelpers.handleDescToHandleInfo;
|
||||
import jdk.internal.classfile.impl.TransformingCodeBuilder;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A builder for code attributes (method bodies). Builders are not created
|
||||
* directly; they are passed to handlers by methods such as {@link
|
||||
* MethodBuilder#withCode(Consumer)} or to code transforms. The elements of a
|
||||
* code can be specified abstractly, by passing a {@link CodeElement} to {@link
|
||||
* #with(ClassfileElement)} or concretely by calling the various {@code withXxx}
|
||||
* #with(ClassFileElement)} or concretely by calling the various {@code withXxx}
|
||||
* methods.
|
||||
*
|
||||
* @see CodeTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CodeBuilder
|
||||
extends ClassfileBuilder<CodeElement, CodeBuilder>
|
||||
extends ClassFileBuilder<CodeElement, CodeBuilder>
|
||||
permits CodeBuilder.BlockCodeBuilder, ChainedCodeBuilder, TerminalCodeBuilder, NonterminalCodeBuilder {
|
||||
|
||||
/**
|
||||
@ -174,7 +178,10 @@ public sealed interface CodeBuilder
|
||||
|
||||
/**
|
||||
* A builder for blocks of code.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface BlockCodeBuilder extends CodeBuilder
|
||||
permits BlockCodeBuilderImpl {
|
||||
/**
|
||||
@ -315,7 +322,10 @@ public sealed interface CodeBuilder
|
||||
* A builder to add catch blocks.
|
||||
*
|
||||
* @see #trying
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface CatchBuilder permits CatchBuilderImpl {
|
||||
/**
|
||||
* Adds a catch block that catches an exception of the given type.
|
||||
@ -328,7 +338,8 @@ public sealed interface CodeBuilder
|
||||
* @param catchHandler handler that receives a {@linkplain CodeBuilder} to
|
||||
* generate the body of the catch block.
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if an existing catch block catches an exception of the given type.
|
||||
* @throws IllegalArgumentException if an existing catch block catches an exception of the given type
|
||||
* or {@code exceptionType} represents a primitive type
|
||||
* @see #catchingMulti
|
||||
* @see #catchingAll
|
||||
*/
|
||||
@ -582,6 +593,7 @@ public sealed interface CodeBuilder
|
||||
* Generate an instruction to create a new object
|
||||
* @param type the object type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code type} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder newObjectInstruction(ClassDesc type) {
|
||||
return newObjectInstruction(constantPool().classEntry(type));
|
||||
@ -611,6 +623,7 @@ public sealed interface CodeBuilder
|
||||
* Generate an instruction to create a new array of reference
|
||||
* @param type the component type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code type} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder newReferenceArrayInstruction(ClassDesc type) {
|
||||
return newReferenceArrayInstruction(constantPool().classEntry(type));
|
||||
@ -1005,6 +1018,7 @@ public sealed interface CodeBuilder
|
||||
* Generate an instruction to create a new array of reference
|
||||
* @param className the component type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code className} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder anewarray(ClassDesc className) {
|
||||
return newReferenceArrayInstruction(constantPool().classEntry(className));
|
||||
@ -1097,6 +1111,7 @@ public sealed interface CodeBuilder
|
||||
* Generate an instruction to check whether an object is of the given type
|
||||
* @param type the object type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code type} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder checkcast(ClassDesc type) {
|
||||
return typeCheckInstruction(Opcode.CHECKCAST, type);
|
||||
@ -1467,6 +1482,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the field name
|
||||
* @param type the field type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder getfield(ClassDesc owner, String name, ClassDesc type) {
|
||||
return fieldInstruction(Opcode.GETFIELD, owner, name, type);
|
||||
@ -1487,6 +1503,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the field name
|
||||
* @param type the field type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder getstatic(ClassDesc owner, String name, ClassDesc type) {
|
||||
return fieldInstruction(Opcode.GETSTATIC, owner, name, type);
|
||||
@ -1655,7 +1672,7 @@ public sealed interface CodeBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an instruction to branch if int comparison succeeds
|
||||
* Generate an instruction to branch if reference comparison succeeds
|
||||
* @param target the branch target
|
||||
* @return this builder
|
||||
*/
|
||||
@ -1664,7 +1681,7 @@ public sealed interface CodeBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an instruction to branch if int comparison succeeds
|
||||
* Generate an instruction to branch if reference comparison succeeds
|
||||
* @param target the branch target
|
||||
* @return this builder
|
||||
*/
|
||||
@ -1846,6 +1863,7 @@ public sealed interface CodeBuilder
|
||||
* Generate an instruction to determine if an object is of the given type
|
||||
* @param target the target type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code target} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder instanceof_(ClassDesc target) {
|
||||
return typeCheckInstruction(Opcode.INSTANCEOF, constantPool().classEntry(target));
|
||||
@ -1884,6 +1902,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the method name
|
||||
* @param type the method type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder invokeinterface(ClassDesc owner, String name, MethodTypeDesc type) {
|
||||
return invokeInstruction(Opcode.INVOKEINTERFACE, constantPool().interfaceMethodRefEntry(owner, name, type));
|
||||
@ -1916,6 +1935,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the method name
|
||||
* @param type the method type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder invokespecial(ClassDesc owner, String name, MethodTypeDesc type) {
|
||||
return invokeInstruction(Opcode.INVOKESPECIAL, owner, name, type, false);
|
||||
@ -1929,6 +1949,7 @@ public sealed interface CodeBuilder
|
||||
* @param type the method type
|
||||
* @param isInterface the interface method invocation indication
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder invokespecial(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) {
|
||||
return invokeInstruction(Opcode.INVOKESPECIAL, owner, name, type, isInterface);
|
||||
@ -1958,6 +1979,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the method name
|
||||
* @param type the method type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder invokestatic(ClassDesc owner, String name, MethodTypeDesc type) {
|
||||
return invokeInstruction(Opcode.INVOKESTATIC, owner, name, type, false);
|
||||
@ -1970,6 +1992,7 @@ public sealed interface CodeBuilder
|
||||
* @param type the method type
|
||||
* @param isInterface the interface method invocation indication
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder invokestatic(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) {
|
||||
return invokeInstruction(Opcode.INVOKESTATIC, owner, name, type, isInterface);
|
||||
@ -1990,6 +2013,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the method name
|
||||
* @param type the method type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder invokevirtual(ClassDesc owner, String name, MethodTypeDesc type) {
|
||||
return invokeInstruction(Opcode.INVOKEVIRTUAL, owner, name, type, false);
|
||||
@ -2316,6 +2340,7 @@ public sealed interface CodeBuilder
|
||||
* @param array the array type
|
||||
* @param dims the number of dimensions
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code array} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder multianewarray(ClassDesc array, int dims) {
|
||||
return newMultidimensionalArrayInstruction(dims, constantPool().classEntry(array));
|
||||
@ -2334,6 +2359,7 @@ public sealed interface CodeBuilder
|
||||
* Generate an instruction to create a new object
|
||||
* @param clazz the new class type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code clazz} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder new_(ClassDesc clazz) {
|
||||
return newObjectInstruction(constantPool().classEntry(clazz));
|
||||
@ -2379,6 +2405,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the field name
|
||||
* @param type the field type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder putfield(ClassDesc owner, String name, ClassDesc type) {
|
||||
return fieldInstruction(Opcode.PUTFIELD, owner, name, type);
|
||||
@ -2399,6 +2426,7 @@ public sealed interface CodeBuilder
|
||||
* @param name the field name
|
||||
* @param type the field type
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code owner} represents a primitive type
|
||||
*/
|
||||
default CodeBuilder putstatic(ClassDesc owner, String name, ClassDesc type) {
|
||||
return fieldInstruction(Opcode.PUTSTATIC, owner, name, type);
|
@ -22,21 +22,26 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.StackMapTableAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.StackMapTableAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A {@link ClassfileElement} that can appear when traversing the elements
|
||||
* of a {@link CodeModel} or be presented to a {@link CodeBuilder}. Code elements
|
||||
* A marker interface for elements that can appear when traversing
|
||||
* a {@link CodeModel} or be presented to a {@link CodeBuilder}. Code elements
|
||||
* are either an {@link Instruction}, which models an instruction in the body
|
||||
* of a method, or a {@link PseudoInstruction}, which models metadata from
|
||||
* the code attribute, such as line number metadata, local variable metadata,
|
||||
* exception metadata, label target metadata, etc.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface CodeElement extends ClassfileElement
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CodeElement extends ClassFileElement
|
||||
permits Instruction, PseudoInstruction,
|
||||
CustomAttribute, RuntimeVisibleTypeAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute,
|
||||
StackMapTableAttribute {
|
@ -23,21 +23,25 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.internal.classfile.attribute.CodeAttribute;
|
||||
import java.lang.classfile.attribute.CodeAttribute;
|
||||
import jdk.internal.classfile.impl.BufferedCodeBuilder;
|
||||
import jdk.internal.classfile.impl.CodeImpl;
|
||||
import jdk.internal.classfile.instruction.ExceptionCatch;
|
||||
import java.lang.classfile.instruction.ExceptionCatch;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the body of a method (the {@code Code} attribute). The instructions
|
||||
* of the method body are accessed via a streaming view (e.g., {@link
|
||||
* #elements()}).
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CodeModel
|
||||
extends CompoundElement<CodeElement>, AttributedElement, MethodElement
|
||||
permits CodeAttribute, BufferedCodeBuilder.Model, CodeImpl {
|
@ -22,21 +22,25 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import jdk.internal.classfile.impl.TransformImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A transformation on streams of {@link CodeElement}.
|
||||
*
|
||||
* @see ClassfileTransform
|
||||
* @see ClassFileTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
@FunctionalInterface
|
||||
public non-sealed interface CodeTransform
|
||||
extends ClassfileTransform<CodeTransform, CodeElement, CodeBuilder> {
|
||||
extends ClassFileTransform<CodeTransform, CodeElement, CodeBuilder> {
|
||||
|
||||
/**
|
||||
* A code transform that sends all elements to the builder.
|
||||
@ -81,11 +85,22 @@ public non-sealed interface CodeTransform
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec
|
||||
* The default implementation returns this code transform chained with another
|
||||
* code transform from the argument. Chaining of two transforms requires to
|
||||
* involve a chained builder serving as a target builder for this transform
|
||||
* and also as a source of elements for the downstream transform.
|
||||
*/
|
||||
@Override
|
||||
default CodeTransform andThen(CodeTransform t) {
|
||||
return new TransformImpl.ChainedCodeTransform(this, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec The default implementation returns a resolved transform bound
|
||||
* to the given code builder.
|
||||
*/
|
||||
@Override
|
||||
default ResolvedTransform<CodeElement> resolve(CodeBuilder builder) {
|
||||
return new TransformImpl.ResolvedTransformImpl<>(e -> accept(builder, e),
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@ -32,18 +32,23 @@ import java.util.Spliterators;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A {@link ClassfileElement} that has complex structure defined in terms of
|
||||
* A {@link ClassFileElement} that has complex structure defined in terms of
|
||||
* other classfile elements, such as a method, field, method body, or entire
|
||||
* class. When encountering a {@linkplain CompoundElement}, clients have the
|
||||
* option to treat the element as a single entity (e.g., an entire method)
|
||||
* or to traverse the contents of that element with the methods in this class
|
||||
* (e.g., {@link #elements()}, {@link #forEachElement(Consumer)}, etc.)
|
||||
* @param <E> the element type
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface CompoundElement<E extends ClassfileElement>
|
||||
extends ClassfileElement, Iterable<E>
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CompoundElement<E extends ClassFileElement>
|
||||
extends ClassFileElement, Iterable<E>
|
||||
permits ClassModel, CodeModel, FieldModel, MethodModel, jdk.internal.classfile.impl.AbstractUnboundModel {
|
||||
/**
|
||||
* Invoke the provided handler with each element contained in this
|
@ -22,9 +22,9 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a non-standard attribute of a classfile. Clients should extend
|
||||
@ -32,17 +32,41 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* and provide an {@link AttributeMapper} to mediate between the classfile
|
||||
* format and the {@linkplain CustomAttribute} representation.
|
||||
* @param <T> the custom attribute type
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@SuppressWarnings("exports")
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public abstract non-sealed class CustomAttribute<T extends CustomAttribute<T>>
|
||||
extends UnboundAttribute.CustomAttribute<T>
|
||||
implements CodeElement, ClassElement, MethodElement, FieldElement {
|
||||
implements Attribute<T>, CodeElement, ClassElement, MethodElement, FieldElement {
|
||||
|
||||
private final AttributeMapper<T> mapper;
|
||||
|
||||
/**
|
||||
* Construct a {@linkplain CustomAttribute}.
|
||||
* @param mapper the attribute mapper
|
||||
*/
|
||||
protected CustomAttribute(AttributeMapper<T> mapper) {
|
||||
super(mapper);
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final AttributeMapper<T> attributeMapper() {
|
||||
return mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String attributeName() {
|
||||
return mapper.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public final void writeTo(BufWriter buf) {
|
||||
mapper.writeAttribute(buf, (T) this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("CustomAttribute[name=%s]", mapper.name());
|
||||
}
|
||||
}
|
@ -23,27 +23,31 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.ChainedFieldBuilder;
|
||||
import jdk.internal.classfile.impl.TerminalFieldBuilder;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A builder for fields. Builders are not created directly; they are passed
|
||||
* to handlers by methods such as {@link ClassBuilder#withField(Utf8Entry, Utf8Entry, Consumer)}
|
||||
* or to field transforms. The elements of a field can be specified
|
||||
* abstractly (by passing a {@link FieldElement} to {@link #with(ClassfileElement)}
|
||||
* abstractly (by passing a {@link FieldElement} to {@link #with(ClassFileElement)}
|
||||
* or concretely by calling the various {@code withXxx} methods.
|
||||
*
|
||||
* @see FieldTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface FieldBuilder
|
||||
extends ClassfileBuilder<FieldElement, FieldBuilder>
|
||||
extends ClassFileBuilder<FieldElement, FieldBuilder>
|
||||
permits TerminalFieldBuilder, ChainedFieldBuilder {
|
||||
|
||||
/**
|
@ -22,23 +22,28 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.attribute.ConstantValueAttribute;
|
||||
import jdk.internal.classfile.attribute.DeprecatedAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.SignatureAttribute;
|
||||
import jdk.internal.classfile.attribute.SyntheticAttribute;
|
||||
import jdk.internal.classfile.attribute.UnknownAttribute;
|
||||
import java.lang.classfile.attribute.ConstantValueAttribute;
|
||||
import java.lang.classfile.attribute.DeprecatedAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.SignatureAttribute;
|
||||
import java.lang.classfile.attribute.SyntheticAttribute;
|
||||
import java.lang.classfile.attribute.UnknownAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A {@link ClassfileElement} that can appear when traversing the elements
|
||||
* of a {@link FieldModel} or be presented to a {@link FieldBuilder}.
|
||||
* A marker interface for elements that can appear when traversing
|
||||
* a {@link FieldModel} or be presented to a {@link FieldBuilder}.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface FieldElement extends ClassfileElement
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface FieldElement extends ClassFileElement
|
||||
permits AccessFlags,
|
||||
CustomAttribute, ConstantValueAttribute, DeprecatedAttribute,
|
||||
RuntimeInvisibleAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute,
|
@ -23,20 +23,24 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BufferedFieldBuilder;
|
||||
import jdk.internal.classfile.impl.FieldImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a field. The contents of the field can be traversed via
|
||||
* a streaming view (e.g., {@link #elements()}), or via random access (e.g.,
|
||||
* {@link #flags()}), or by freely mixing the two.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface FieldModel
|
||||
extends WritableElement<FieldModel>, CompoundElement<FieldElement>, AttributedElement, ClassElement
|
||||
permits BufferedFieldBuilder.Model, FieldImpl {
|
@ -22,22 +22,26 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import jdk.internal.classfile.impl.TransformImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A transformation on streams of {@link FieldElement}.
|
||||
*
|
||||
* @see ClassfileTransform
|
||||
* @see ClassFileTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
@FunctionalInterface
|
||||
public non-sealed interface FieldTransform
|
||||
extends ClassfileTransform<FieldTransform, FieldElement, FieldBuilder> {
|
||||
extends ClassFileTransform<FieldTransform, FieldElement, FieldBuilder> {
|
||||
|
||||
/**
|
||||
* A field transform that sends all elements to the builder.
|
||||
@ -96,11 +100,22 @@ public non-sealed interface FieldTransform
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec
|
||||
* The default implementation returns this field transform chained with another
|
||||
* field transform from the argument. Chaining of two transforms requires to
|
||||
* involve a chained builder serving as a target builder for this transform
|
||||
* and also as a source of elements for the downstream transform.
|
||||
*/
|
||||
@Override
|
||||
default FieldTransform andThen(FieldTransform t) {
|
||||
return new TransformImpl.ChainedFieldTransform(this, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec The default implementation returns a resolved transform bound
|
||||
* to the given field builder.
|
||||
*/
|
||||
@Override
|
||||
default ResolvedTransform<FieldElement> resolve(FieldBuilder builder) {
|
||||
return new TransformImpl.ResolvedTransformImpl<>(e -> accept(builder, e),
|
@ -23,38 +23,42 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.impl.AbstractInstruction;
|
||||
import jdk.internal.classfile.instruction.ArrayLoadInstruction;
|
||||
import jdk.internal.classfile.instruction.ArrayStoreInstruction;
|
||||
import jdk.internal.classfile.instruction.BranchInstruction;
|
||||
import jdk.internal.classfile.instruction.ConstantInstruction;
|
||||
import jdk.internal.classfile.instruction.ConvertInstruction;
|
||||
import jdk.internal.classfile.instruction.DiscontinuedInstruction;
|
||||
import jdk.internal.classfile.instruction.FieldInstruction;
|
||||
import jdk.internal.classfile.instruction.IncrementInstruction;
|
||||
import jdk.internal.classfile.instruction.InvokeDynamicInstruction;
|
||||
import jdk.internal.classfile.instruction.InvokeInstruction;
|
||||
import jdk.internal.classfile.instruction.LoadInstruction;
|
||||
import jdk.internal.classfile.instruction.LookupSwitchInstruction;
|
||||
import jdk.internal.classfile.instruction.MonitorInstruction;
|
||||
import jdk.internal.classfile.instruction.NewMultiArrayInstruction;
|
||||
import jdk.internal.classfile.instruction.NewObjectInstruction;
|
||||
import jdk.internal.classfile.instruction.NewPrimitiveArrayInstruction;
|
||||
import jdk.internal.classfile.instruction.NewReferenceArrayInstruction;
|
||||
import jdk.internal.classfile.instruction.NopInstruction;
|
||||
import jdk.internal.classfile.instruction.OperatorInstruction;
|
||||
import jdk.internal.classfile.instruction.ReturnInstruction;
|
||||
import jdk.internal.classfile.instruction.StackInstruction;
|
||||
import jdk.internal.classfile.instruction.StoreInstruction;
|
||||
import jdk.internal.classfile.instruction.TableSwitchInstruction;
|
||||
import jdk.internal.classfile.instruction.ThrowInstruction;
|
||||
import jdk.internal.classfile.instruction.TypeCheckInstruction;
|
||||
import java.lang.classfile.instruction.ArrayLoadInstruction;
|
||||
import java.lang.classfile.instruction.ArrayStoreInstruction;
|
||||
import java.lang.classfile.instruction.BranchInstruction;
|
||||
import java.lang.classfile.instruction.ConstantInstruction;
|
||||
import java.lang.classfile.instruction.ConvertInstruction;
|
||||
import java.lang.classfile.instruction.DiscontinuedInstruction;
|
||||
import java.lang.classfile.instruction.FieldInstruction;
|
||||
import java.lang.classfile.instruction.IncrementInstruction;
|
||||
import java.lang.classfile.instruction.InvokeDynamicInstruction;
|
||||
import java.lang.classfile.instruction.InvokeInstruction;
|
||||
import java.lang.classfile.instruction.LoadInstruction;
|
||||
import java.lang.classfile.instruction.LookupSwitchInstruction;
|
||||
import java.lang.classfile.instruction.MonitorInstruction;
|
||||
import java.lang.classfile.instruction.NewMultiArrayInstruction;
|
||||
import java.lang.classfile.instruction.NewObjectInstruction;
|
||||
import java.lang.classfile.instruction.NewPrimitiveArrayInstruction;
|
||||
import java.lang.classfile.instruction.NewReferenceArrayInstruction;
|
||||
import java.lang.classfile.instruction.NopInstruction;
|
||||
import java.lang.classfile.instruction.OperatorInstruction;
|
||||
import java.lang.classfile.instruction.ReturnInstruction;
|
||||
import java.lang.classfile.instruction.StackInstruction;
|
||||
import java.lang.classfile.instruction.StoreInstruction;
|
||||
import java.lang.classfile.instruction.TableSwitchInstruction;
|
||||
import java.lang.classfile.instruction.ThrowInstruction;
|
||||
import java.lang.classfile.instruction.TypeCheckInstruction;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models an executable instruction in a method body.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface Instruction extends CodeElement
|
||||
permits ArrayLoadInstruction, ArrayStoreInstruction, BranchInstruction,
|
||||
ConstantInstruction, ConvertInstruction, DiscontinuedInstruction,
|
@ -22,20 +22,24 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.InterfacesImpl;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the interfaces of a class. Delivered as a {@link
|
||||
* jdk.internal.classfile.ClassElement} when traversing a {@link ClassModel}.
|
||||
* java.lang.classfile.ClassElement} when traversing a {@link ClassModel}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface Interfaces
|
||||
extends ClassElement
|
||||
permits InterfacesImpl {
|
@ -22,9 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.impl.LabelImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A marker for a position within the instructions of a method body. The
|
||||
@ -37,8 +38,11 @@ import jdk.internal.classfile.impl.LabelImpl;
|
||||
* traversing the elements of a {@linkplain CodeModel}, {@linkplain Label}
|
||||
* markers will be delivered at the position to which they correspond. A label
|
||||
* can be bound to the current position within a {@linkplain CodeBuilder} via
|
||||
* {@link CodeBuilder#labelBinding(Label)} or {@link CodeBuilder#with(ClassfileElement)}.
|
||||
* {@link CodeBuilder#labelBinding(Label)} or {@link CodeBuilder#with(ClassFileElement)}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface Label
|
||||
permits LabelImpl {
|
||||
}
|
@ -23,27 +23,31 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.ChainedMethodBuilder;
|
||||
import jdk.internal.classfile.impl.TerminalMethodBuilder;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A builder for methods. Builders are not created directly; they are passed
|
||||
* to handlers by methods such as {@link ClassBuilder#withMethod(Utf8Entry, Utf8Entry, int, Consumer)}
|
||||
* or to method transforms. The elements of a method can be specified
|
||||
* abstractly (by passing a {@link MethodElement} to {@link #with(ClassfileElement)}
|
||||
* abstractly (by passing a {@link MethodElement} to {@link #with(ClassFileElement)}
|
||||
* or concretely by calling the various {@code withXxx} methods.
|
||||
*
|
||||
* @see MethodTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface MethodBuilder
|
||||
extends ClassfileBuilder<MethodElement, MethodBuilder>
|
||||
extends ClassFileBuilder<MethodElement, MethodBuilder>
|
||||
permits ChainedMethodBuilder, TerminalMethodBuilder {
|
||||
|
||||
/**
|
@ -22,28 +22,33 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.attribute.AnnotationDefaultAttribute;
|
||||
import jdk.internal.classfile.attribute.DeprecatedAttribute;
|
||||
import jdk.internal.classfile.attribute.ExceptionsAttribute;
|
||||
import jdk.internal.classfile.attribute.MethodParametersAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.SignatureAttribute;
|
||||
import jdk.internal.classfile.attribute.SyntheticAttribute;
|
||||
import jdk.internal.classfile.attribute.UnknownAttribute;
|
||||
import java.lang.classfile.attribute.AnnotationDefaultAttribute;
|
||||
import java.lang.classfile.attribute.DeprecatedAttribute;
|
||||
import java.lang.classfile.attribute.ExceptionsAttribute;
|
||||
import java.lang.classfile.attribute.MethodParametersAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.SignatureAttribute;
|
||||
import java.lang.classfile.attribute.SyntheticAttribute;
|
||||
import java.lang.classfile.attribute.UnknownAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A {@link ClassfileElement} that can appear when traversing the elements
|
||||
* of a {@link MethodModel} or be presented to a {@link MethodBuilder}.
|
||||
* A marker interface for elements that can appear when traversing
|
||||
* a {@link MethodModel} or be presented to a {@link MethodBuilder}.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface MethodElement
|
||||
extends ClassfileElement
|
||||
extends ClassFileElement
|
||||
permits AccessFlags, CodeModel, CustomAttribute,
|
||||
AnnotationDefaultAttribute, DeprecatedAttribute,
|
||||
ExceptionsAttribute, MethodParametersAttribute,
|
@ -23,20 +23,24 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.MethodTypeDesc;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BufferedMethodBuilder;
|
||||
import jdk.internal.classfile.impl.MethodImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a method. The contents of the method can be traversed via
|
||||
* a streaming view (e.g., {@link #elements()}), or via random access (e.g.,
|
||||
* {@link #flags()}), or by freely mixing the two.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface MethodModel
|
||||
extends WritableElement<MethodModel>, CompoundElement<MethodElement>, AttributedElement, ClassElement
|
||||
permits BufferedMethodBuilder.Model, MethodImpl {
|
@ -22,17 +22,21 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.MethodTypeDesc;
|
||||
import java.util.List;
|
||||
import jdk.internal.classfile.impl.SignaturesImpl;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the generic signature of a method, as defined by {@jvms 4.7.9}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface MethodSignature
|
||||
permits SignaturesImpl.MethodSignatureImpl {
|
||||
|
||||
@ -52,7 +56,7 @@ public sealed interface MethodSignature
|
||||
String signatureString();
|
||||
|
||||
/**
|
||||
* @return method signature for a raw (no generic information) method descriptor
|
||||
* {@return a method signature for a raw (no generic information) method descriptor}
|
||||
* @param methodDescriptor the method descriptor
|
||||
*/
|
||||
public static MethodSignature of(MethodTypeDesc methodDescriptor) {
|
||||
@ -66,7 +70,7 @@ public sealed interface MethodSignature
|
||||
}
|
||||
|
||||
/**
|
||||
* @return method signature
|
||||
* {@return a method signature}
|
||||
* @param result signature for the return type
|
||||
* @param arguments signatures for the method arguments
|
||||
*/
|
||||
@ -80,7 +84,7 @@ public sealed interface MethodSignature
|
||||
}
|
||||
|
||||
/**
|
||||
* @return method signature
|
||||
* {@return a method signature}
|
||||
* @param typeParameters signatures for the type parameters
|
||||
* @param exceptions signatures for the exceptions
|
||||
* @param result signature for the return type
|
@ -22,22 +22,26 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import jdk.internal.classfile.impl.TransformImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A transformation on streams of {@link MethodElement}.
|
||||
*
|
||||
* @see ClassfileTransform
|
||||
* @see ClassFileTransform
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
@FunctionalInterface
|
||||
public non-sealed interface MethodTransform
|
||||
extends ClassfileTransform<MethodTransform, MethodElement, MethodBuilder> {
|
||||
extends ClassFileTransform<MethodTransform, MethodElement, MethodBuilder> {
|
||||
|
||||
/**
|
||||
* A method transform that sends all elements to the builder.
|
||||
@ -107,6 +111,10 @@ public non-sealed interface MethodTransform
|
||||
return new TransformImpl.MethodCodeTransform(xform);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec The default implementation returns a resolved transform bound
|
||||
* to the given method builder.
|
||||
*/
|
||||
@Override
|
||||
default ResolvedTransform<MethodElement> resolve(MethodBuilder builder) {
|
||||
return new TransformImpl.ResolvedTransformImpl<>(e -> accept(builder, e),
|
||||
@ -114,6 +122,13 @@ public non-sealed interface MethodTransform
|
||||
() -> atStart(builder));
|
||||
}
|
||||
|
||||
/**
|
||||
* @implSpec
|
||||
* The default implementation returns this method transform chained with another
|
||||
* method transform from the argument. Chaining of two transforms requires to
|
||||
* involve a chained builder serving as a target builder for this transform
|
||||
* and also as a source of elements for the downstream transform.
|
||||
*/
|
||||
@Override
|
||||
default MethodTransform andThen(MethodTransform t) {
|
||||
return new TransformImpl.ChainedMethodTransform(this, t);
|
@ -22,10 +22,11 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ConstantDesc;
|
||||
import java.lang.constant.ConstantDescs;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Describes the opcodes of the JVM instruction set, as described in {@jvms 6.5}.
|
||||
@ -34,654 +35,672 @@ import java.lang.constant.ConstantDescs;
|
||||
*
|
||||
* @see Instruction
|
||||
* @see PseudoInstruction
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public enum Opcode {
|
||||
|
||||
/** Do nothing */
|
||||
NOP(Classfile.NOP, 1, Kind.NOP),
|
||||
NOP(ClassFile.NOP, 1, Kind.NOP),
|
||||
|
||||
/** Push null */
|
||||
ACONST_NULL(Classfile.ACONST_NULL, 1, Kind.CONSTANT, TypeKind.ReferenceType, 0, ConstantDescs.NULL),
|
||||
ACONST_NULL(ClassFile.ACONST_NULL, 1, Kind.CONSTANT, TypeKind.ReferenceType, 0, ConstantDescs.NULL),
|
||||
|
||||
/** Push int constant -1 */
|
||||
ICONST_M1(Classfile.ICONST_M1, 1, Kind.CONSTANT, TypeKind.IntType, 0, -1),
|
||||
ICONST_M1(ClassFile.ICONST_M1, 1, Kind.CONSTANT, TypeKind.IntType, 0, -1),
|
||||
|
||||
/** Push int constant 0 */
|
||||
ICONST_0(Classfile.ICONST_0, 1, Kind.CONSTANT, TypeKind.IntType, 0, 0),
|
||||
ICONST_0(ClassFile.ICONST_0, 1, Kind.CONSTANT, TypeKind.IntType, 0, 0),
|
||||
|
||||
/** Push int constant 1 */
|
||||
ICONST_1(Classfile.ICONST_1, 1, Kind.CONSTANT, TypeKind.IntType, 0, 1),
|
||||
ICONST_1(ClassFile.ICONST_1, 1, Kind.CONSTANT, TypeKind.IntType, 0, 1),
|
||||
|
||||
/** Push int constant 2 */
|
||||
ICONST_2(Classfile.ICONST_2, 1, Kind.CONSTANT, TypeKind.IntType, 0, 2),
|
||||
ICONST_2(ClassFile.ICONST_2, 1, Kind.CONSTANT, TypeKind.IntType, 0, 2),
|
||||
|
||||
/** Push int constant 3 */
|
||||
ICONST_3(Classfile.ICONST_3, 1, Kind.CONSTANT, TypeKind.IntType, 0, 3),
|
||||
ICONST_3(ClassFile.ICONST_3, 1, Kind.CONSTANT, TypeKind.IntType, 0, 3),
|
||||
|
||||
/** Push int constant 4 */
|
||||
ICONST_4(Classfile.ICONST_4, 1, Kind.CONSTANT, TypeKind.IntType, 0, 4),
|
||||
ICONST_4(ClassFile.ICONST_4, 1, Kind.CONSTANT, TypeKind.IntType, 0, 4),
|
||||
|
||||
/** Push int constant 5 */
|
||||
ICONST_5(Classfile.ICONST_5, 1, Kind.CONSTANT, TypeKind.IntType, 0, 5),
|
||||
ICONST_5(ClassFile.ICONST_5, 1, Kind.CONSTANT, TypeKind.IntType, 0, 5),
|
||||
|
||||
/** Push long constant 0 */
|
||||
LCONST_0(Classfile.LCONST_0, 1, Kind.CONSTANT, TypeKind.LongType, 0, 0L),
|
||||
LCONST_0(ClassFile.LCONST_0, 1, Kind.CONSTANT, TypeKind.LongType, 0, 0L),
|
||||
|
||||
/** Push long constant 1 */
|
||||
LCONST_1(Classfile.LCONST_1, 1, Kind.CONSTANT, TypeKind.LongType, 0, 1L),
|
||||
LCONST_1(ClassFile.LCONST_1, 1, Kind.CONSTANT, TypeKind.LongType, 0, 1L),
|
||||
|
||||
/** Push float constant 0 */
|
||||
FCONST_0(Classfile.FCONST_0, 1, Kind.CONSTANT, TypeKind.FloatType, 0, 0.0f),
|
||||
FCONST_0(ClassFile.FCONST_0, 1, Kind.CONSTANT, TypeKind.FloatType, 0, 0.0f),
|
||||
|
||||
/** Push float constant 1 */
|
||||
FCONST_1(Classfile.FCONST_1, 1, Kind.CONSTANT, TypeKind.FloatType, 0, 1.0f),
|
||||
FCONST_1(ClassFile.FCONST_1, 1, Kind.CONSTANT, TypeKind.FloatType, 0, 1.0f),
|
||||
|
||||
/** Push float constant 2 */
|
||||
FCONST_2(Classfile.FCONST_2, 1, Kind.CONSTANT, TypeKind.FloatType, 0, 2.0f),
|
||||
FCONST_2(ClassFile.FCONST_2, 1, Kind.CONSTANT, TypeKind.FloatType, 0, 2.0f),
|
||||
|
||||
/** Push double constant 0 */
|
||||
DCONST_0(Classfile.DCONST_0, 1, Kind.CONSTANT, TypeKind.DoubleType, 0, 0.0d),
|
||||
DCONST_0(ClassFile.DCONST_0, 1, Kind.CONSTANT, TypeKind.DoubleType, 0, 0.0d),
|
||||
|
||||
/** Push double constant 1 */
|
||||
DCONST_1(Classfile.DCONST_1, 1, Kind.CONSTANT, TypeKind.DoubleType, 0, 1.0d),
|
||||
DCONST_1(ClassFile.DCONST_1, 1, Kind.CONSTANT, TypeKind.DoubleType, 0, 1.0d),
|
||||
|
||||
/** Push byte */
|
||||
BIPUSH(Classfile.BIPUSH, 2, Kind.CONSTANT, TypeKind.ByteType),
|
||||
BIPUSH(ClassFile.BIPUSH, 2, Kind.CONSTANT, TypeKind.ByteType),
|
||||
|
||||
/** Push short */
|
||||
SIPUSH(Classfile.SIPUSH, 3, Kind.CONSTANT, TypeKind.ShortType),
|
||||
SIPUSH(ClassFile.SIPUSH, 3, Kind.CONSTANT, TypeKind.ShortType),
|
||||
|
||||
/** Push item from run-time constant pool */
|
||||
LDC(Classfile.LDC, 2, Kind.CONSTANT),
|
||||
LDC(ClassFile.LDC, 2, Kind.CONSTANT),
|
||||
|
||||
/** Push item from run-time constant pool (wide index) */
|
||||
LDC_W(Classfile.LDC_W, 3, Kind.CONSTANT),
|
||||
LDC_W(ClassFile.LDC_W, 3, Kind.CONSTANT),
|
||||
|
||||
/** Push long or double from run-time constant pool (wide index) */
|
||||
LDC2_W(Classfile.LDC2_W, 3, Kind.CONSTANT),
|
||||
LDC2_W(ClassFile.LDC2_W, 3, Kind.CONSTANT),
|
||||
|
||||
/** Load int from local variable */
|
||||
ILOAD(Classfile.ILOAD, 2, Kind.LOAD, TypeKind.IntType, -1),
|
||||
ILOAD(ClassFile.ILOAD, 2, Kind.LOAD, TypeKind.IntType, -1),
|
||||
|
||||
/** Load long from local variable */
|
||||
LLOAD(Classfile.LLOAD, 2, Kind.LOAD, TypeKind.LongType, -1),
|
||||
LLOAD(ClassFile.LLOAD, 2, Kind.LOAD, TypeKind.LongType, -1),
|
||||
|
||||
/** Load float from local variable */
|
||||
FLOAD(Classfile.FLOAD, 2, Kind.LOAD, TypeKind.FloatType, -1),
|
||||
FLOAD(ClassFile.FLOAD, 2, Kind.LOAD, TypeKind.FloatType, -1),
|
||||
|
||||
/** Load double from local variable */
|
||||
DLOAD(Classfile.DLOAD, 2, Kind.LOAD, TypeKind.DoubleType, -1),
|
||||
DLOAD(ClassFile.DLOAD, 2, Kind.LOAD, TypeKind.DoubleType, -1),
|
||||
|
||||
/** Load reference from local variable */
|
||||
ALOAD(Classfile.ALOAD, 2, Kind.LOAD, TypeKind.ReferenceType, -1),
|
||||
ALOAD(ClassFile.ALOAD, 2, Kind.LOAD, TypeKind.ReferenceType, -1),
|
||||
|
||||
/** Load int from local variable 0 */
|
||||
ILOAD_0(Classfile.ILOAD_0, 1, Kind.LOAD, TypeKind.IntType, 0),
|
||||
ILOAD_0(ClassFile.ILOAD_0, 1, Kind.LOAD, TypeKind.IntType, 0),
|
||||
|
||||
/** Load int from local variable 1 */
|
||||
ILOAD_1(Classfile.ILOAD_1, 1, Kind.LOAD, TypeKind.IntType, 1),
|
||||
ILOAD_1(ClassFile.ILOAD_1, 1, Kind.LOAD, TypeKind.IntType, 1),
|
||||
|
||||
/** Load int from local variable 2 */
|
||||
ILOAD_2(Classfile.ILOAD_2, 1, Kind.LOAD, TypeKind.IntType, 2),
|
||||
ILOAD_2(ClassFile.ILOAD_2, 1, Kind.LOAD, TypeKind.IntType, 2),
|
||||
|
||||
/** Load int from local variable3 */
|
||||
ILOAD_3(Classfile.ILOAD_3, 1, Kind.LOAD, TypeKind.IntType, 3),
|
||||
ILOAD_3(ClassFile.ILOAD_3, 1, Kind.LOAD, TypeKind.IntType, 3),
|
||||
|
||||
/** Load long from local variable 0 */
|
||||
LLOAD_0(Classfile.LLOAD_0, 1, Kind.LOAD, TypeKind.LongType, 0),
|
||||
LLOAD_0(ClassFile.LLOAD_0, 1, Kind.LOAD, TypeKind.LongType, 0),
|
||||
|
||||
/** Load long from local variable 1 */
|
||||
LLOAD_1(Classfile.LLOAD_1, 1, Kind.LOAD, TypeKind.LongType, 1),
|
||||
LLOAD_1(ClassFile.LLOAD_1, 1, Kind.LOAD, TypeKind.LongType, 1),
|
||||
|
||||
/** Load long from local variable 2 */
|
||||
LLOAD_2(Classfile.LLOAD_2, 1, Kind.LOAD, TypeKind.LongType, 2),
|
||||
LLOAD_2(ClassFile.LLOAD_2, 1, Kind.LOAD, TypeKind.LongType, 2),
|
||||
|
||||
/** Load long from local variable 3 */
|
||||
LLOAD_3(Classfile.LLOAD_3, 1, Kind.LOAD, TypeKind.LongType, 3),
|
||||
LLOAD_3(ClassFile.LLOAD_3, 1, Kind.LOAD, TypeKind.LongType, 3),
|
||||
|
||||
/** Load float from local variable 0 */
|
||||
FLOAD_0(Classfile.FLOAD_0, 1, Kind.LOAD, TypeKind.FloatType, 0),
|
||||
FLOAD_0(ClassFile.FLOAD_0, 1, Kind.LOAD, TypeKind.FloatType, 0),
|
||||
|
||||
/** Load float from local variable 1 */
|
||||
FLOAD_1(Classfile.FLOAD_1, 1, Kind.LOAD, TypeKind.FloatType, 1),
|
||||
FLOAD_1(ClassFile.FLOAD_1, 1, Kind.LOAD, TypeKind.FloatType, 1),
|
||||
|
||||
/** Load float from local variable 2 */
|
||||
FLOAD_2(Classfile.FLOAD_2, 1, Kind.LOAD, TypeKind.FloatType, 2),
|
||||
FLOAD_2(ClassFile.FLOAD_2, 1, Kind.LOAD, TypeKind.FloatType, 2),
|
||||
|
||||
/** Load float from local variable 3 */
|
||||
FLOAD_3(Classfile.FLOAD_3, 1, Kind.LOAD, TypeKind.FloatType, 3),
|
||||
FLOAD_3(ClassFile.FLOAD_3, 1, Kind.LOAD, TypeKind.FloatType, 3),
|
||||
|
||||
/** Load double from local variable 0 */
|
||||
DLOAD_0(Classfile.DLOAD_0, 1, Kind.LOAD, TypeKind.DoubleType, 0),
|
||||
DLOAD_0(ClassFile.DLOAD_0, 1, Kind.LOAD, TypeKind.DoubleType, 0),
|
||||
|
||||
/** Load double from local variable 1 */
|
||||
DLOAD_1(Classfile.DLOAD_1, 1, Kind.LOAD, TypeKind.DoubleType, 1),
|
||||
DLOAD_1(ClassFile.DLOAD_1, 1, Kind.LOAD, TypeKind.DoubleType, 1),
|
||||
|
||||
/** Load double from local variable 2 */
|
||||
DLOAD_2(Classfile.DLOAD_2, 1, Kind.LOAD, TypeKind.DoubleType, 2),
|
||||
DLOAD_2(ClassFile.DLOAD_2, 1, Kind.LOAD, TypeKind.DoubleType, 2),
|
||||
|
||||
/** Load double from local variable 3 */
|
||||
DLOAD_3(Classfile.DLOAD_3, 1, Kind.LOAD, TypeKind.DoubleType, 3),
|
||||
DLOAD_3(ClassFile.DLOAD_3, 1, Kind.LOAD, TypeKind.DoubleType, 3),
|
||||
|
||||
/** Load reference from local variable 0 */
|
||||
ALOAD_0(Classfile.ALOAD_0, 1, Kind.LOAD, TypeKind.ReferenceType, 0),
|
||||
ALOAD_0(ClassFile.ALOAD_0, 1, Kind.LOAD, TypeKind.ReferenceType, 0),
|
||||
|
||||
/** Load reference from local variable 1 */
|
||||
ALOAD_1(Classfile.ALOAD_1, 1, Kind.LOAD, TypeKind.ReferenceType, 1),
|
||||
ALOAD_1(ClassFile.ALOAD_1, 1, Kind.LOAD, TypeKind.ReferenceType, 1),
|
||||
|
||||
/** Load reference from local variable 2 */
|
||||
ALOAD_2(Classfile.ALOAD_2, 1, Kind.LOAD, TypeKind.ReferenceType, 2),
|
||||
ALOAD_2(ClassFile.ALOAD_2, 1, Kind.LOAD, TypeKind.ReferenceType, 2),
|
||||
|
||||
/** Load reference from local variable 3 */
|
||||
ALOAD_3(Classfile.ALOAD_3, 1, Kind.LOAD, TypeKind.ReferenceType, 3),
|
||||
ALOAD_3(ClassFile.ALOAD_3, 1, Kind.LOAD, TypeKind.ReferenceType, 3),
|
||||
|
||||
/** Load int from array */
|
||||
IALOAD(Classfile.IALOAD, 1, Kind.ARRAY_LOAD, TypeKind.IntType),
|
||||
IALOAD(ClassFile.IALOAD, 1, Kind.ARRAY_LOAD, TypeKind.IntType),
|
||||
|
||||
/** Load long from array */
|
||||
LALOAD(Classfile.LALOAD, 1, Kind.ARRAY_LOAD, TypeKind.LongType),
|
||||
LALOAD(ClassFile.LALOAD, 1, Kind.ARRAY_LOAD, TypeKind.LongType),
|
||||
|
||||
/** Load float from array */
|
||||
FALOAD(Classfile.FALOAD, 1, Kind.ARRAY_LOAD, TypeKind.FloatType),
|
||||
FALOAD(ClassFile.FALOAD, 1, Kind.ARRAY_LOAD, TypeKind.FloatType),
|
||||
|
||||
/** Load double from array */
|
||||
DALOAD(Classfile.DALOAD, 1, Kind.ARRAY_LOAD, TypeKind.DoubleType),
|
||||
DALOAD(ClassFile.DALOAD, 1, Kind.ARRAY_LOAD, TypeKind.DoubleType),
|
||||
|
||||
/** Load reference from array */
|
||||
AALOAD(Classfile.AALOAD, 1, Kind.ARRAY_LOAD, TypeKind.ReferenceType),
|
||||
AALOAD(ClassFile.AALOAD, 1, Kind.ARRAY_LOAD, TypeKind.ReferenceType),
|
||||
|
||||
/** Load byte from array */
|
||||
BALOAD(Classfile.BALOAD, 1, Kind.ARRAY_LOAD, TypeKind.ByteType),
|
||||
BALOAD(ClassFile.BALOAD, 1, Kind.ARRAY_LOAD, TypeKind.ByteType),
|
||||
|
||||
/** Load char from array */
|
||||
CALOAD(Classfile.CALOAD, 1, Kind.ARRAY_LOAD, TypeKind.CharType),
|
||||
CALOAD(ClassFile.CALOAD, 1, Kind.ARRAY_LOAD, TypeKind.CharType),
|
||||
|
||||
/** Load short from array */
|
||||
SALOAD(Classfile.SALOAD, 1, Kind.ARRAY_LOAD, TypeKind.ShortType),
|
||||
SALOAD(ClassFile.SALOAD, 1, Kind.ARRAY_LOAD, TypeKind.ShortType),
|
||||
|
||||
/** Store int into local variable */
|
||||
ISTORE(Classfile.ISTORE, 2, Kind.STORE, TypeKind.IntType, -1),
|
||||
ISTORE(ClassFile.ISTORE, 2, Kind.STORE, TypeKind.IntType, -1),
|
||||
|
||||
/** Store long into local variable */
|
||||
LSTORE(Classfile.LSTORE, 2, Kind.STORE, TypeKind.LongType, -1),
|
||||
LSTORE(ClassFile.LSTORE, 2, Kind.STORE, TypeKind.LongType, -1),
|
||||
|
||||
/** Store float into local variable */
|
||||
FSTORE(Classfile.FSTORE, 2, Kind.STORE, TypeKind.FloatType, -1),
|
||||
FSTORE(ClassFile.FSTORE, 2, Kind.STORE, TypeKind.FloatType, -1),
|
||||
|
||||
/** Store double into local variable */
|
||||
DSTORE(Classfile.DSTORE, 2, Kind.STORE, TypeKind.DoubleType, -1),
|
||||
DSTORE(ClassFile.DSTORE, 2, Kind.STORE, TypeKind.DoubleType, -1),
|
||||
|
||||
/** Store reference into local variable */
|
||||
ASTORE(Classfile.ASTORE, 2, Kind.STORE, TypeKind.ReferenceType, -1),
|
||||
ASTORE(ClassFile.ASTORE, 2, Kind.STORE, TypeKind.ReferenceType, -1),
|
||||
|
||||
/** Store int into local variable 0 */
|
||||
ISTORE_0(Classfile.ISTORE_0, 1, Kind.STORE, TypeKind.IntType, 0),
|
||||
ISTORE_0(ClassFile.ISTORE_0, 1, Kind.STORE, TypeKind.IntType, 0),
|
||||
|
||||
/** Store int into local variable 1 */
|
||||
ISTORE_1(Classfile.ISTORE_1, 1, Kind.STORE, TypeKind.IntType, 1),
|
||||
ISTORE_1(ClassFile.ISTORE_1, 1, Kind.STORE, TypeKind.IntType, 1),
|
||||
|
||||
/** Store int into local variable 2 */
|
||||
ISTORE_2(Classfile.ISTORE_2, 1, Kind.STORE, TypeKind.IntType, 2),
|
||||
ISTORE_2(ClassFile.ISTORE_2, 1, Kind.STORE, TypeKind.IntType, 2),
|
||||
|
||||
/** Store int into local variable 3 */
|
||||
ISTORE_3(Classfile.ISTORE_3, 1, Kind.STORE, TypeKind.IntType, 3),
|
||||
ISTORE_3(ClassFile.ISTORE_3, 1, Kind.STORE, TypeKind.IntType, 3),
|
||||
|
||||
/** Store long into local variable 0 */
|
||||
LSTORE_0(Classfile.LSTORE_0, 1, Kind.STORE, TypeKind.LongType, 0),
|
||||
LSTORE_0(ClassFile.LSTORE_0, 1, Kind.STORE, TypeKind.LongType, 0),
|
||||
|
||||
/** Store long into local variable 1 */
|
||||
LSTORE_1(Classfile.LSTORE_1, 1, Kind.STORE, TypeKind.LongType, 1),
|
||||
LSTORE_1(ClassFile.LSTORE_1, 1, Kind.STORE, TypeKind.LongType, 1),
|
||||
|
||||
/** Store long into local variable 2 */
|
||||
LSTORE_2(Classfile.LSTORE_2, 1, Kind.STORE, TypeKind.LongType, 2),
|
||||
LSTORE_2(ClassFile.LSTORE_2, 1, Kind.STORE, TypeKind.LongType, 2),
|
||||
|
||||
/** Store long into local variable 3 */
|
||||
LSTORE_3(Classfile.LSTORE_3, 1, Kind.STORE, TypeKind.LongType, 3),
|
||||
LSTORE_3(ClassFile.LSTORE_3, 1, Kind.STORE, TypeKind.LongType, 3),
|
||||
|
||||
/** Store float into local variable 0 */
|
||||
FSTORE_0(Classfile.FSTORE_0, 1, Kind.STORE, TypeKind.FloatType, 0),
|
||||
FSTORE_0(ClassFile.FSTORE_0, 1, Kind.STORE, TypeKind.FloatType, 0),
|
||||
|
||||
/** Store float into local variable 1 */
|
||||
FSTORE_1(Classfile.FSTORE_1, 1, Kind.STORE, TypeKind.FloatType, 1),
|
||||
FSTORE_1(ClassFile.FSTORE_1, 1, Kind.STORE, TypeKind.FloatType, 1),
|
||||
|
||||
/** Store float into local variable 2 */
|
||||
FSTORE_2(Classfile.FSTORE_2, 1, Kind.STORE, TypeKind.FloatType, 2),
|
||||
FSTORE_2(ClassFile.FSTORE_2, 1, Kind.STORE, TypeKind.FloatType, 2),
|
||||
|
||||
/** Store float into local variable 3 */
|
||||
FSTORE_3(Classfile.FSTORE_3, 1, Kind.STORE, TypeKind.FloatType, 3),
|
||||
FSTORE_3(ClassFile.FSTORE_3, 1, Kind.STORE, TypeKind.FloatType, 3),
|
||||
|
||||
/** Store double into local variable 0 */
|
||||
DSTORE_0(Classfile.DSTORE_0, 1, Kind.STORE, TypeKind.DoubleType, 0),
|
||||
DSTORE_0(ClassFile.DSTORE_0, 1, Kind.STORE, TypeKind.DoubleType, 0),
|
||||
|
||||
/** Store double into local variable 1 */
|
||||
DSTORE_1(Classfile.DSTORE_1, 1, Kind.STORE, TypeKind.DoubleType, 1),
|
||||
DSTORE_1(ClassFile.DSTORE_1, 1, Kind.STORE, TypeKind.DoubleType, 1),
|
||||
|
||||
/** Store double into local variable 2 */
|
||||
DSTORE_2(Classfile.DSTORE_2, 1, Kind.STORE, TypeKind.DoubleType, 2),
|
||||
DSTORE_2(ClassFile.DSTORE_2, 1, Kind.STORE, TypeKind.DoubleType, 2),
|
||||
|
||||
/** Store double into local variable 3 */
|
||||
DSTORE_3(Classfile.DSTORE_3, 1, Kind.STORE, TypeKind.DoubleType, 3),
|
||||
DSTORE_3(ClassFile.DSTORE_3, 1, Kind.STORE, TypeKind.DoubleType, 3),
|
||||
|
||||
/** Store reference into local variable 0 */
|
||||
ASTORE_0(Classfile.ASTORE_0, 1, Kind.STORE, TypeKind.ReferenceType, 0),
|
||||
ASTORE_0(ClassFile.ASTORE_0, 1, Kind.STORE, TypeKind.ReferenceType, 0),
|
||||
|
||||
/** Store reference into local variable 1 */
|
||||
ASTORE_1(Classfile.ASTORE_1, 1, Kind.STORE, TypeKind.ReferenceType, 1),
|
||||
ASTORE_1(ClassFile.ASTORE_1, 1, Kind.STORE, TypeKind.ReferenceType, 1),
|
||||
|
||||
/** Store reference into local variable 2 */
|
||||
ASTORE_2(Classfile.ASTORE_2, 1, Kind.STORE, TypeKind.ReferenceType, 2),
|
||||
ASTORE_2(ClassFile.ASTORE_2, 1, Kind.STORE, TypeKind.ReferenceType, 2),
|
||||
|
||||
/** Store reference into local variable 3 */
|
||||
ASTORE_3(Classfile.ASTORE_3, 1, Kind.STORE, TypeKind.ReferenceType, 3),
|
||||
ASTORE_3(ClassFile.ASTORE_3, 1, Kind.STORE, TypeKind.ReferenceType, 3),
|
||||
|
||||
/** Store into int array */
|
||||
IASTORE(Classfile.IASTORE, 1, Kind.ARRAY_STORE, TypeKind.IntType),
|
||||
IASTORE(ClassFile.IASTORE, 1, Kind.ARRAY_STORE, TypeKind.IntType),
|
||||
|
||||
/** Store into long array */
|
||||
LASTORE(Classfile.LASTORE, 1, Kind.ARRAY_STORE, TypeKind.LongType),
|
||||
LASTORE(ClassFile.LASTORE, 1, Kind.ARRAY_STORE, TypeKind.LongType),
|
||||
|
||||
/** Store into float array */
|
||||
FASTORE(Classfile.FASTORE, 1, Kind.ARRAY_STORE, TypeKind.FloatType),
|
||||
FASTORE(ClassFile.FASTORE, 1, Kind.ARRAY_STORE, TypeKind.FloatType),
|
||||
|
||||
/** Store into double array */
|
||||
DASTORE(Classfile.DASTORE, 1, Kind.ARRAY_STORE, TypeKind.DoubleType),
|
||||
DASTORE(ClassFile.DASTORE, 1, Kind.ARRAY_STORE, TypeKind.DoubleType),
|
||||
|
||||
/** Store into reference array */
|
||||
AASTORE(Classfile.AASTORE, 1, Kind.ARRAY_STORE, TypeKind.ReferenceType),
|
||||
AASTORE(ClassFile.AASTORE, 1, Kind.ARRAY_STORE, TypeKind.ReferenceType),
|
||||
|
||||
/** Store into byte array */
|
||||
BASTORE(Classfile.BASTORE, 1, Kind.ARRAY_STORE, TypeKind.ByteType),
|
||||
BASTORE(ClassFile.BASTORE, 1, Kind.ARRAY_STORE, TypeKind.ByteType),
|
||||
|
||||
/** Store into char array */
|
||||
CASTORE(Classfile.CASTORE, 1, Kind.ARRAY_STORE, TypeKind.CharType),
|
||||
CASTORE(ClassFile.CASTORE, 1, Kind.ARRAY_STORE, TypeKind.CharType),
|
||||
|
||||
/** Store into short array */
|
||||
SASTORE(Classfile.SASTORE, 1, Kind.ARRAY_STORE, TypeKind.ShortType),
|
||||
SASTORE(ClassFile.SASTORE, 1, Kind.ARRAY_STORE, TypeKind.ShortType),
|
||||
|
||||
/** Pop the top operand stack value */
|
||||
POP(Classfile.POP, 1, Kind.STACK),
|
||||
POP(ClassFile.POP, 1, Kind.STACK),
|
||||
|
||||
/** Pop the top one or two operand stack values */
|
||||
POP2(Classfile.POP2, 1, Kind.STACK),
|
||||
POP2(ClassFile.POP2, 1, Kind.STACK),
|
||||
|
||||
/** Duplicate the top operand stack value */
|
||||
DUP(Classfile.DUP, 1, Kind.STACK),
|
||||
DUP(ClassFile.DUP, 1, Kind.STACK),
|
||||
|
||||
/** Duplicate the top operand stack value and insert two values down */
|
||||
DUP_X1(Classfile.DUP_X1, 1, Kind.STACK),
|
||||
DUP_X1(ClassFile.DUP_X1, 1, Kind.STACK),
|
||||
|
||||
/** Duplicate the top operand stack value and insert two or three values down */
|
||||
DUP_X2(Classfile.DUP_X2, 1, Kind.STACK),
|
||||
DUP_X2(ClassFile.DUP_X2, 1, Kind.STACK),
|
||||
|
||||
/** Duplicate the top one or two operand stack values */
|
||||
DUP2(Classfile.DUP2, 1, Kind.STACK),
|
||||
DUP2(ClassFile.DUP2, 1, Kind.STACK),
|
||||
|
||||
/** Duplicate the top one or two operand stack values and insert two or three values down */
|
||||
DUP2_X1(Classfile.DUP2_X1, 1, Kind.STACK),
|
||||
DUP2_X1(ClassFile.DUP2_X1, 1, Kind.STACK),
|
||||
|
||||
/** Duplicate the top one or two operand stack values and insert two, three, or four values down */
|
||||
DUP2_X2(Classfile.DUP2_X2, 1, Kind.STACK),
|
||||
DUP2_X2(ClassFile.DUP2_X2, 1, Kind.STACK),
|
||||
|
||||
/** Swap the top two operand stack values */
|
||||
SWAP(Classfile.SWAP, 1, Kind.STACK),
|
||||
SWAP(ClassFile.SWAP, 1, Kind.STACK),
|
||||
|
||||
/** Add int */
|
||||
IADD(Classfile.IADD, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IADD(ClassFile.IADD, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Add long */
|
||||
LADD(Classfile.LADD, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LADD(ClassFile.LADD, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Add float */
|
||||
FADD(Classfile.FADD, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FADD(ClassFile.FADD, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Add double */
|
||||
DADD(Classfile.DADD, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DADD(ClassFile.DADD, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Subtract int */
|
||||
ISUB(Classfile.ISUB, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
ISUB(ClassFile.ISUB, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Subtract long */
|
||||
LSUB(Classfile.LSUB, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LSUB(ClassFile.LSUB, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Subtract float */
|
||||
FSUB(Classfile.FSUB, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FSUB(ClassFile.FSUB, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Subtract double */
|
||||
DSUB(Classfile.DSUB, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DSUB(ClassFile.DSUB, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Multiply int */
|
||||
IMUL(Classfile.IMUL, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IMUL(ClassFile.IMUL, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Multiply long */
|
||||
LMUL(Classfile.LMUL, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LMUL(ClassFile.LMUL, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Multiply float */
|
||||
FMUL(Classfile.FMUL, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FMUL(ClassFile.FMUL, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Multiply double */
|
||||
DMUL(Classfile.DMUL, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DMUL(ClassFile.DMUL, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Divide int */
|
||||
IDIV(Classfile.IDIV, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IDIV(ClassFile.IDIV, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Divide long */
|
||||
LDIV(Classfile.LDIV, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LDIV(ClassFile.LDIV, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Divide float */
|
||||
FDIV(Classfile.FDIV, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FDIV(ClassFile.FDIV, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Divide double */
|
||||
DDIV(Classfile.DDIV, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DDIV(ClassFile.DDIV, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Remainder int */
|
||||
IREM(Classfile.IREM, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IREM(ClassFile.IREM, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Remainder long */
|
||||
LREM(Classfile.LREM, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LREM(ClassFile.LREM, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Remainder float */
|
||||
FREM(Classfile.FREM, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FREM(ClassFile.FREM, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Remainder double */
|
||||
DREM(Classfile.DREM, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DREM(ClassFile.DREM, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Negate int */
|
||||
INEG(Classfile.INEG, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
INEG(ClassFile.INEG, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Negate long */
|
||||
LNEG(Classfile.LNEG, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LNEG(ClassFile.LNEG, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Negate float */
|
||||
FNEG(Classfile.FNEG, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FNEG(ClassFile.FNEG, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Negate double */
|
||||
DNEG(Classfile.DNEG, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DNEG(ClassFile.DNEG, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Shift left int */
|
||||
ISHL(Classfile.ISHL, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
ISHL(ClassFile.ISHL, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Shift left long */
|
||||
LSHL(Classfile.LSHL, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LSHL(ClassFile.LSHL, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Shift right int */
|
||||
ISHR(Classfile.ISHR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
ISHR(ClassFile.ISHR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Shift right long */
|
||||
LSHR(Classfile.LSHR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LSHR(ClassFile.LSHR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Logical shift right int */
|
||||
IUSHR(Classfile.IUSHR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IUSHR(ClassFile.IUSHR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Logical shift right long */
|
||||
LUSHR(Classfile.LUSHR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LUSHR(ClassFile.LUSHR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Boolean AND int */
|
||||
IAND(Classfile.IAND, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IAND(ClassFile.IAND, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Boolean AND long */
|
||||
LAND(Classfile.LAND, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LAND(ClassFile.LAND, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Boolean OR int */
|
||||
IOR(Classfile.IOR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IOR(ClassFile.IOR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Boolean OR long */
|
||||
LOR(Classfile.LOR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LOR(ClassFile.LOR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Boolean XOR int */
|
||||
IXOR(Classfile.IXOR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
IXOR(ClassFile.IXOR, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Boolean XOR long */
|
||||
LXOR(Classfile.LXOR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LXOR(ClassFile.LXOR, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Increment local variable by constant */
|
||||
IINC(Classfile.IINC, 3, Kind.INCREMENT, TypeKind.IntType, -1),
|
||||
IINC(ClassFile.IINC, 3, Kind.INCREMENT, TypeKind.IntType, -1),
|
||||
|
||||
/** Convert int to long */
|
||||
I2L(Classfile.I2L, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.LongType),
|
||||
I2L(ClassFile.I2L, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.LongType),
|
||||
|
||||
/** Convert int to float */
|
||||
I2F(Classfile.I2F, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.FloatType),
|
||||
I2F(ClassFile.I2F, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.FloatType),
|
||||
|
||||
/** Convert int to double */
|
||||
I2D(Classfile.I2D, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.DoubleType),
|
||||
I2D(ClassFile.I2D, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.DoubleType),
|
||||
|
||||
/** Convert long to int */
|
||||
L2I(Classfile.L2I, 1, Kind.CONVERT, TypeKind.LongType, TypeKind.IntType),
|
||||
L2I(ClassFile.L2I, 1, Kind.CONVERT, TypeKind.LongType, TypeKind.IntType),
|
||||
|
||||
/** Convert long to float */
|
||||
L2F(Classfile.L2F, 1, Kind.CONVERT, TypeKind.LongType, TypeKind.FloatType),
|
||||
L2F(ClassFile.L2F, 1, Kind.CONVERT, TypeKind.LongType, TypeKind.FloatType),
|
||||
|
||||
/** Convert long to double */
|
||||
L2D(Classfile.L2D, 1, Kind.CONVERT, TypeKind.LongType, TypeKind.DoubleType),
|
||||
L2D(ClassFile.L2D, 1, Kind.CONVERT, TypeKind.LongType, TypeKind.DoubleType),
|
||||
|
||||
/** Convert float to int */
|
||||
F2I(Classfile.F2I, 1, Kind.CONVERT, TypeKind.FloatType, TypeKind.IntType),
|
||||
F2I(ClassFile.F2I, 1, Kind.CONVERT, TypeKind.FloatType, TypeKind.IntType),
|
||||
|
||||
/** Convert float to long */
|
||||
F2L(Classfile.F2L, 1, Kind.CONVERT, TypeKind.FloatType, TypeKind.LongType),
|
||||
F2L(ClassFile.F2L, 1, Kind.CONVERT, TypeKind.FloatType, TypeKind.LongType),
|
||||
|
||||
/** Convert float to double */
|
||||
F2D(Classfile.F2D, 1, Kind.CONVERT, TypeKind.FloatType, TypeKind.DoubleType),
|
||||
F2D(ClassFile.F2D, 1, Kind.CONVERT, TypeKind.FloatType, TypeKind.DoubleType),
|
||||
|
||||
/** Convert double to int */
|
||||
D2I(Classfile.D2I, 1, Kind.CONVERT, TypeKind.DoubleType, TypeKind.IntType),
|
||||
D2I(ClassFile.D2I, 1, Kind.CONVERT, TypeKind.DoubleType, TypeKind.IntType),
|
||||
|
||||
/** Convert double to long */
|
||||
D2L(Classfile.D2L, 1, Kind.CONVERT, TypeKind.DoubleType, TypeKind.LongType),
|
||||
D2L(ClassFile.D2L, 1, Kind.CONVERT, TypeKind.DoubleType, TypeKind.LongType),
|
||||
|
||||
/** Convert double to float */
|
||||
D2F(Classfile.D2F, 1, Kind.CONVERT, TypeKind.DoubleType, TypeKind.FloatType),
|
||||
D2F(ClassFile.D2F, 1, Kind.CONVERT, TypeKind.DoubleType, TypeKind.FloatType),
|
||||
|
||||
/** Convert int to byte */
|
||||
I2B(Classfile.I2B, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.ByteType),
|
||||
I2B(ClassFile.I2B, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.ByteType),
|
||||
|
||||
/** Convert int to char */
|
||||
I2C(Classfile.I2C, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.CharType),
|
||||
I2C(ClassFile.I2C, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.CharType),
|
||||
|
||||
/** Convert int to short */
|
||||
I2S(Classfile.I2S, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.ShortType),
|
||||
I2S(ClassFile.I2S, 1, Kind.CONVERT, TypeKind.IntType, TypeKind.ShortType),
|
||||
|
||||
/** Compare long */
|
||||
LCMP(Classfile.LCMP, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
LCMP(ClassFile.LCMP, 1, Kind.OPERATOR, TypeKind.LongType),
|
||||
|
||||
/** Compare float */
|
||||
FCMPL(Classfile.FCMPL, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FCMPL(ClassFile.FCMPL, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Compare float */
|
||||
FCMPG(Classfile.FCMPG, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
FCMPG(ClassFile.FCMPG, 1, Kind.OPERATOR, TypeKind.FloatType),
|
||||
|
||||
/** Compare double */
|
||||
DCMPL(Classfile.DCMPL, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DCMPL(ClassFile.DCMPL, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Compare double */
|
||||
DCMPG(Classfile.DCMPG, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
DCMPG(ClassFile.DCMPG, 1, Kind.OPERATOR, TypeKind.DoubleType),
|
||||
|
||||
/** Branch if int comparison with zero succeeds */
|
||||
IFEQ(Classfile.IFEQ, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IFEQ(ClassFile.IFEQ, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison with zero succeeds */
|
||||
IFNE(Classfile.IFNE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IFNE(ClassFile.IFNE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison with zero succeeds */
|
||||
IFLT(Classfile.IFLT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IFLT(ClassFile.IFLT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison with zero succeeds */
|
||||
IFGE(Classfile.IFGE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IFGE(ClassFile.IFGE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison with zero succeeds */
|
||||
IFGT(Classfile.IFGT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IFGT(ClassFile.IFGT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison with zero succeeds */
|
||||
IFLE(Classfile.IFLE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IFLE(ClassFile.IFLE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison succeeds */
|
||||
IF_ICMPEQ(Classfile.IF_ICMPEQ, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IF_ICMPEQ(ClassFile.IF_ICMPEQ, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison succeeds */
|
||||
IF_ICMPNE(Classfile.IF_ICMPNE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IF_ICMPNE(ClassFile.IF_ICMPNE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison succeeds */
|
||||
IF_ICMPLT(Classfile.IF_ICMPLT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IF_ICMPLT(ClassFile.IF_ICMPLT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison succeeds */
|
||||
IF_ICMPGE(Classfile.IF_ICMPGE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IF_ICMPGE(ClassFile.IF_ICMPGE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison succeeds */
|
||||
IF_ICMPGT(Classfile.IF_ICMPGT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IF_ICMPGT(ClassFile.IF_ICMPGT, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if int comparison succeeds */
|
||||
IF_ICMPLE(Classfile.IF_ICMPLE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IF_ICMPLE(ClassFile.IF_ICMPLE, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch if reference comparison succeeds */
|
||||
IF_ACMPEQ(Classfile.IF_ACMPEQ, 3, Kind.BRANCH, TypeKind.ReferenceType),
|
||||
IF_ACMPEQ(ClassFile.IF_ACMPEQ, 3, Kind.BRANCH, TypeKind.ReferenceType),
|
||||
|
||||
/** Branch if reference comparison succeeds */
|
||||
IF_ACMPNE(Classfile.IF_ACMPNE, 3, Kind.BRANCH, TypeKind.ReferenceType),
|
||||
IF_ACMPNE(ClassFile.IF_ACMPNE, 3, Kind.BRANCH, TypeKind.ReferenceType),
|
||||
|
||||
/** Branch always */
|
||||
GOTO(Classfile.GOTO, 3, Kind.BRANCH, TypeKind.VoidType),
|
||||
GOTO(ClassFile.GOTO, 3, Kind.BRANCH, TypeKind.VoidType),
|
||||
|
||||
/** Jump subroutine */
|
||||
JSR(Classfile.JSR, 3, Kind.DISCONTINUED_JSR),
|
||||
/**
|
||||
* Jump subroutine is discontinued opcode
|
||||
* @see java.lang.classfile.instruction.DiscontinuedInstruction
|
||||
*/
|
||||
JSR(ClassFile.JSR, 3, Kind.DISCONTINUED_JSR),
|
||||
|
||||
/** Return from subroutine */
|
||||
RET(Classfile.RET, 2, Kind.DISCONTINUED_RET),
|
||||
/**
|
||||
* Return from subroutine is discontinued opcode
|
||||
* @see java.lang.classfile.instruction.DiscontinuedInstruction
|
||||
*/
|
||||
RET(ClassFile.RET, 2, Kind.DISCONTINUED_RET),
|
||||
|
||||
/** Access jump table by index and jump */
|
||||
TABLESWITCH(Classfile.TABLESWITCH, -1, Kind.TABLE_SWITCH),
|
||||
TABLESWITCH(ClassFile.TABLESWITCH, -1, Kind.TABLE_SWITCH),
|
||||
|
||||
/** Access jump table by key match and jump */
|
||||
LOOKUPSWITCH(Classfile.LOOKUPSWITCH, -1, Kind.LOOKUP_SWITCH),
|
||||
LOOKUPSWITCH(ClassFile.LOOKUPSWITCH, -1, Kind.LOOKUP_SWITCH),
|
||||
|
||||
/** Return int from method */
|
||||
IRETURN(Classfile.IRETURN, 1, Kind.RETURN, TypeKind.IntType),
|
||||
IRETURN(ClassFile.IRETURN, 1, Kind.RETURN, TypeKind.IntType),
|
||||
|
||||
/** Return long from method */
|
||||
LRETURN(Classfile.LRETURN, 1, Kind.RETURN, TypeKind.LongType),
|
||||
LRETURN(ClassFile.LRETURN, 1, Kind.RETURN, TypeKind.LongType),
|
||||
|
||||
/** Return float from method */
|
||||
FRETURN(Classfile.FRETURN, 1, Kind.RETURN, TypeKind.FloatType),
|
||||
FRETURN(ClassFile.FRETURN, 1, Kind.RETURN, TypeKind.FloatType),
|
||||
|
||||
/** Return double from method */
|
||||
DRETURN(Classfile.DRETURN, 1, Kind.RETURN, TypeKind.DoubleType),
|
||||
DRETURN(ClassFile.DRETURN, 1, Kind.RETURN, TypeKind.DoubleType),
|
||||
|
||||
/** Return reference from method */
|
||||
ARETURN(Classfile.ARETURN, 1, Kind.RETURN, TypeKind.ReferenceType),
|
||||
ARETURN(ClassFile.ARETURN, 1, Kind.RETURN, TypeKind.ReferenceType),
|
||||
|
||||
/** Return void from method */
|
||||
RETURN(Classfile.RETURN, 1, Kind.RETURN, TypeKind.VoidType),
|
||||
RETURN(ClassFile.RETURN, 1, Kind.RETURN, TypeKind.VoidType),
|
||||
|
||||
/** Get static field from class */
|
||||
GETSTATIC(Classfile.GETSTATIC, 3, Kind.FIELD_ACCESS),
|
||||
GETSTATIC(ClassFile.GETSTATIC, 3, Kind.FIELD_ACCESS),
|
||||
|
||||
/** Set static field in class */
|
||||
PUTSTATIC(Classfile.PUTSTATIC, 3, Kind.FIELD_ACCESS),
|
||||
PUTSTATIC(ClassFile.PUTSTATIC, 3, Kind.FIELD_ACCESS),
|
||||
|
||||
/** Fetch field from object */
|
||||
GETFIELD(Classfile.GETFIELD, 3, Kind.FIELD_ACCESS),
|
||||
GETFIELD(ClassFile.GETFIELD, 3, Kind.FIELD_ACCESS),
|
||||
|
||||
/** Set field in object */
|
||||
PUTFIELD(Classfile.PUTFIELD, 3, Kind.FIELD_ACCESS),
|
||||
PUTFIELD(ClassFile.PUTFIELD, 3, Kind.FIELD_ACCESS),
|
||||
|
||||
/** Invoke instance method; dispatch based on class */
|
||||
INVOKEVIRTUAL(Classfile.INVOKEVIRTUAL, 3, Kind.INVOKE),
|
||||
INVOKEVIRTUAL(ClassFile.INVOKEVIRTUAL, 3, Kind.INVOKE),
|
||||
|
||||
/**
|
||||
* Invoke instance method; direct invocation of instance initialization
|
||||
* methods and methods of the current class and its supertypes
|
||||
*/
|
||||
INVOKESPECIAL(Classfile.INVOKESPECIAL, 3, Kind.INVOKE),
|
||||
INVOKESPECIAL(ClassFile.INVOKESPECIAL, 3, Kind.INVOKE),
|
||||
|
||||
/** Invoke a class (static) method */
|
||||
INVOKESTATIC(Classfile.INVOKESTATIC, 3, Kind.INVOKE),
|
||||
INVOKESTATIC(ClassFile.INVOKESTATIC, 3, Kind.INVOKE),
|
||||
|
||||
/** Invoke interface method */
|
||||
INVOKEINTERFACE(Classfile.INVOKEINTERFACE, 5, Kind.INVOKE),
|
||||
INVOKEINTERFACE(ClassFile.INVOKEINTERFACE, 5, Kind.INVOKE),
|
||||
|
||||
/** Invoke a dynamically-computed call site */
|
||||
INVOKEDYNAMIC(Classfile.INVOKEDYNAMIC, 5, Kind.INVOKE_DYNAMIC),
|
||||
INVOKEDYNAMIC(ClassFile.INVOKEDYNAMIC, 5, Kind.INVOKE_DYNAMIC),
|
||||
|
||||
/** Create new object */
|
||||
NEW(Classfile.NEW, 3, Kind.NEW_OBJECT),
|
||||
NEW(ClassFile.NEW, 3, Kind.NEW_OBJECT),
|
||||
|
||||
/** Create new array */
|
||||
NEWARRAY(Classfile.NEWARRAY, 2, Kind.NEW_PRIMITIVE_ARRAY),
|
||||
NEWARRAY(ClassFile.NEWARRAY, 2, Kind.NEW_PRIMITIVE_ARRAY),
|
||||
|
||||
/** Create new array of reference */
|
||||
ANEWARRAY(Classfile.ANEWARRAY, 3, Kind.NEW_REF_ARRAY),
|
||||
ANEWARRAY(ClassFile.ANEWARRAY, 3, Kind.NEW_REF_ARRAY),
|
||||
|
||||
/** Get length of array */
|
||||
ARRAYLENGTH(Classfile.ARRAYLENGTH, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
ARRAYLENGTH(ClassFile.ARRAYLENGTH, 1, Kind.OPERATOR, TypeKind.IntType),
|
||||
|
||||
/** Throw exception or error */
|
||||
ATHROW(Classfile.ATHROW, 1, Kind.THROW_EXCEPTION),
|
||||
ATHROW(ClassFile.ATHROW, 1, Kind.THROW_EXCEPTION),
|
||||
|
||||
/** Check whether object is of given type */
|
||||
CHECKCAST(Classfile.CHECKCAST, 3, Kind.TYPE_CHECK),
|
||||
CHECKCAST(ClassFile.CHECKCAST, 3, Kind.TYPE_CHECK),
|
||||
|
||||
/** Determine if object is of given type */
|
||||
INSTANCEOF(Classfile.INSTANCEOF, 3, Kind.TYPE_CHECK),
|
||||
INSTANCEOF(ClassFile.INSTANCEOF, 3, Kind.TYPE_CHECK),
|
||||
|
||||
/** Enter monitor for object */
|
||||
MONITORENTER(Classfile.MONITORENTER, 1, Kind.MONITOR),
|
||||
MONITORENTER(ClassFile.MONITORENTER, 1, Kind.MONITOR),
|
||||
|
||||
/** Exit monitor for object */
|
||||
MONITOREXIT(Classfile.MONITOREXIT, 1, Kind.MONITOR),
|
||||
MONITOREXIT(ClassFile.MONITOREXIT, 1, Kind.MONITOR),
|
||||
|
||||
/** Create new multidimensional array */
|
||||
MULTIANEWARRAY(Classfile.MULTIANEWARRAY, 4, Kind.NEW_MULTI_ARRAY),
|
||||
MULTIANEWARRAY(ClassFile.MULTIANEWARRAY, 4, Kind.NEW_MULTI_ARRAY),
|
||||
|
||||
/** Branch if reference is null */
|
||||
IFNULL(Classfile.IFNULL, 3, Kind.BRANCH, TypeKind.ReferenceType),
|
||||
IFNULL(ClassFile.IFNULL, 3, Kind.BRANCH, TypeKind.ReferenceType),
|
||||
|
||||
/** Branch if reference not null */
|
||||
IFNONNULL(Classfile.IFNONNULL, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
IFNONNULL(ClassFile.IFNONNULL, 3, Kind.BRANCH, TypeKind.IntType),
|
||||
|
||||
/** Branch always (wide index) */
|
||||
GOTO_W(Classfile.GOTO_W, 5, Kind.BRANCH, TypeKind.VoidType),
|
||||
GOTO_W(ClassFile.GOTO_W, 5, Kind.BRANCH, TypeKind.VoidType),
|
||||
|
||||
/** Jump subroutine (wide index) */
|
||||
JSR_W(Classfile.JSR_W, 5, Kind.DISCONTINUED_JSR),
|
||||
/**
|
||||
* Jump subroutine (wide index) is discontinued opcode
|
||||
* @see java.lang.classfile.instruction.DiscontinuedInstruction
|
||||
*/
|
||||
JSR_W(ClassFile.JSR_W, 5, Kind.DISCONTINUED_JSR),
|
||||
|
||||
/** Load int from local variable (wide index) */
|
||||
ILOAD_W((Classfile.WIDE << 8) | Classfile.ILOAD, 4, Kind.LOAD, TypeKind.IntType, -1),
|
||||
ILOAD_W((ClassFile.WIDE << 8) | ClassFile.ILOAD, 4, Kind.LOAD, TypeKind.IntType, -1),
|
||||
|
||||
/** Load long from local variable (wide index) */
|
||||
LLOAD_W((Classfile.WIDE << 8) | Classfile.LLOAD, 4, Kind.LOAD, TypeKind.LongType, -1),
|
||||
LLOAD_W((ClassFile.WIDE << 8) | ClassFile.LLOAD, 4, Kind.LOAD, TypeKind.LongType, -1),
|
||||
|
||||
/** Load float from local variable (wide index) */
|
||||
FLOAD_W((Classfile.WIDE << 8) | Classfile.FLOAD, 4, Kind.LOAD, TypeKind.FloatType, -1),
|
||||
FLOAD_W((ClassFile.WIDE << 8) | ClassFile.FLOAD, 4, Kind.LOAD, TypeKind.FloatType, -1),
|
||||
|
||||
/** Load double from local variable (wide index) */
|
||||
DLOAD_W((Classfile.WIDE << 8) | Classfile.DLOAD, 4, Kind.LOAD, TypeKind.DoubleType, -1),
|
||||
DLOAD_W((ClassFile.WIDE << 8) | ClassFile.DLOAD, 4, Kind.LOAD, TypeKind.DoubleType, -1),
|
||||
|
||||
/** Load reference from local variable (wide index) */
|
||||
ALOAD_W((Classfile.WIDE << 8) | Classfile.ALOAD, 4, Kind.LOAD, TypeKind.ReferenceType, -1),
|
||||
ALOAD_W((ClassFile.WIDE << 8) | ClassFile.ALOAD, 4, Kind.LOAD, TypeKind.ReferenceType, -1),
|
||||
|
||||
/** Store int into local variable (wide index) */
|
||||
ISTORE_W((Classfile.WIDE << 8) | Classfile.ISTORE, 4, Kind.STORE, TypeKind.IntType, -1),
|
||||
ISTORE_W((ClassFile.WIDE << 8) | ClassFile.ISTORE, 4, Kind.STORE, TypeKind.IntType, -1),
|
||||
|
||||
/** Store long into local variable (wide index) */
|
||||
LSTORE_W((Classfile.WIDE << 8) | Classfile.LSTORE, 4, Kind.STORE, TypeKind.LongType, -1),
|
||||
LSTORE_W((ClassFile.WIDE << 8) | ClassFile.LSTORE, 4, Kind.STORE, TypeKind.LongType, -1),
|
||||
|
||||
/** Store float into local variable (wide index) */
|
||||
FSTORE_W((Classfile.WIDE << 8) | Classfile.FSTORE, 4, Kind.STORE, TypeKind.FloatType, -1),
|
||||
FSTORE_W((ClassFile.WIDE << 8) | ClassFile.FSTORE, 4, Kind.STORE, TypeKind.FloatType, -1),
|
||||
|
||||
/** Store double into local variable (wide index) */
|
||||
DSTORE_W((Classfile.WIDE << 8) | Classfile.DSTORE, 4, Kind.STORE, TypeKind.DoubleType, -1),
|
||||
DSTORE_W((ClassFile.WIDE << 8) | ClassFile.DSTORE, 4, Kind.STORE, TypeKind.DoubleType, -1),
|
||||
|
||||
/** Store reference into local variable (wide index) */
|
||||
ASTORE_W((Classfile.WIDE << 8) | Classfile.ASTORE, 4, Kind.STORE, TypeKind.ReferenceType, -1),
|
||||
ASTORE_W((ClassFile.WIDE << 8) | ClassFile.ASTORE, 4, Kind.STORE, TypeKind.ReferenceType, -1),
|
||||
|
||||
/** Return from subroutine (wide index) */
|
||||
RET_W((Classfile.WIDE << 8) | Classfile.RET, 4, Kind.DISCONTINUED_RET),
|
||||
/**
|
||||
* Return from subroutine (wide index) is discontinued opcode
|
||||
* @see java.lang.classfile.instruction.DiscontinuedInstruction
|
||||
*/
|
||||
RET_W((ClassFile.WIDE << 8) | ClassFile.RET, 4, Kind.DISCONTINUED_RET),
|
||||
|
||||
/** Increment local variable by constant (wide index) */
|
||||
IINC_W((Classfile.WIDE << 8) | Classfile.IINC, 6, Kind.INCREMENT, TypeKind.IntType, -1);
|
||||
IINC_W((ClassFile.WIDE << 8) | ClassFile.IINC, 6, Kind.INCREMENT, TypeKind.IntType, -1);
|
||||
|
||||
/**
|
||||
* Kinds of opcodes.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public static enum Kind {
|
||||
|
||||
/**
|
||||
@ -1042,6 +1061,7 @@ public enum Opcode {
|
||||
*
|
||||
* @see Opcode#JSR
|
||||
* @see Opcode#JSR_W
|
||||
* @see java.lang.classfile.instruction.DiscontinuedInstruction
|
||||
*/
|
||||
DISCONTINUED_JSR,
|
||||
|
||||
@ -1050,6 +1070,7 @@ public enum Opcode {
|
||||
*
|
||||
* @see Opcode#RET
|
||||
* @see Opcode#RET_W
|
||||
* @see java.lang.classfile.instruction.DiscontinuedInstruction
|
||||
*/
|
||||
DISCONTINUED_RET;
|
||||
}
|
@ -22,16 +22,17 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.attribute.CodeAttribute;
|
||||
import jdk.internal.classfile.instruction.CharacterRange;
|
||||
import jdk.internal.classfile.instruction.ExceptionCatch;
|
||||
import jdk.internal.classfile.instruction.LabelTarget;
|
||||
import jdk.internal.classfile.instruction.LineNumber;
|
||||
import jdk.internal.classfile.instruction.LocalVariable;
|
||||
import jdk.internal.classfile.instruction.LocalVariableType;
|
||||
import java.lang.classfile.attribute.CodeAttribute;
|
||||
import java.lang.classfile.instruction.CharacterRange;
|
||||
import java.lang.classfile.instruction.ExceptionCatch;
|
||||
import java.lang.classfile.instruction.LabelTarget;
|
||||
import java.lang.classfile.instruction.LineNumber;
|
||||
import java.lang.classfile.instruction.LocalVariable;
|
||||
import java.lang.classfile.instruction.LocalVariableType;
|
||||
import jdk.internal.classfile.impl.AbstractPseudoInstruction;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models metadata about a {@link CodeAttribute}, such as entries in the
|
||||
@ -39,8 +40,11 @@ import jdk.internal.classfile.impl.AbstractPseudoInstruction;
|
||||
* between instructions and labels. Pseudo-instructions are delivered as part
|
||||
* of the element stream of a {@link CodeModel}. Delivery of some
|
||||
* pseudo-instructions can be disabled by modifying the value of classfile
|
||||
* options (e.g., {@link Classfile.DebugElementsOption}).
|
||||
* options (e.g., {@link ClassFile.DebugElementsOption}).
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface PseudoInstruction
|
||||
extends CodeElement
|
||||
permits CharacterRange, ExceptionCatch, LabelTarget, LineNumber, LocalVariable, LocalVariableType, AbstractPseudoInstruction {
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import jdk.internal.classfile.impl.SignaturesImpl;
|
||||
@ -31,10 +31,15 @@ import java.util.List;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import java.util.Optional;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models generic Java type signatures, as defined in {@jvms 4.7.9.1}.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface Signature {
|
||||
|
||||
/** {@return the raw signature string} */
|
||||
@ -50,8 +55,8 @@ public sealed interface Signature {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return a Java type signature}
|
||||
* @param classDesc the symbolic description of the Java type
|
||||
* @return Java type signature
|
||||
*/
|
||||
public static Signature of(ClassDesc classDesc) {
|
||||
requireNonNull(classDesc);
|
||||
@ -64,7 +69,10 @@ public sealed interface Signature {
|
||||
|
||||
/**
|
||||
* Models the signature of a primitive type or void
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface BaseTypeSig extends Signature
|
||||
permits SignaturesImpl.BaseTypeSigImpl {
|
||||
|
||||
@ -97,7 +105,11 @@ public sealed interface Signature {
|
||||
/**
|
||||
* Models the signature of a reference type, which may be a class, interface,
|
||||
* type variable, or array type.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RefTypeSig
|
||||
extends Signature
|
||||
permits ArrayTypeSig, ClassTypeSig, TypeVarSig {
|
||||
@ -105,7 +117,10 @@ public sealed interface Signature {
|
||||
|
||||
/**
|
||||
* Models the signature of a possibly-parameterized class or interface type.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ClassTypeSig
|
||||
extends RefTypeSig, ThrowableSig
|
||||
permits SignaturesImpl.ClassTypeSigImpl {
|
||||
@ -169,14 +184,20 @@ public sealed interface Signature {
|
||||
|
||||
/**
|
||||
* Models the type argument.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface TypeArg
|
||||
permits SignaturesImpl.TypeArgImpl {
|
||||
|
||||
/**
|
||||
* Indicator for whether a wildcard has default bound, no bound,
|
||||
* an upper bound, or a lower bound
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public enum WildcardIndicator {
|
||||
|
||||
/**
|
||||
@ -252,7 +273,10 @@ public sealed interface Signature {
|
||||
|
||||
/**
|
||||
* Models the signature of a type variable.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface TypeVarSig
|
||||
extends RefTypeSig, ThrowableSig
|
||||
permits SignaturesImpl.TypeVarSigImpl {
|
||||
@ -271,7 +295,10 @@ public sealed interface Signature {
|
||||
|
||||
/**
|
||||
* Models the signature of an array type.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ArrayTypeSig
|
||||
extends RefTypeSig
|
||||
permits SignaturesImpl.ArrayTypeSigImpl {
|
||||
@ -304,7 +331,10 @@ public sealed interface Signature {
|
||||
|
||||
/**
|
||||
* Models a signature for a type parameter of a generic class or method.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface TypeParam
|
||||
permits SignaturesImpl.TypeParamImpl {
|
||||
|
||||
@ -346,7 +376,11 @@ public sealed interface Signature {
|
||||
|
||||
/**
|
||||
* Models a signature for a throwable type.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ThrowableSig extends Signature {
|
||||
}
|
||||
}
|
@ -22,15 +22,19 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.SuperclassImpl;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the superclass of a class. Delivered as a {@link
|
||||
* jdk.internal.classfile.ClassElement} when traversing a {@link ClassModel}.
|
||||
* java.lang.classfile.ClassElement} when traversing a {@link ClassModel}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface Superclass
|
||||
extends ClassElement
|
||||
permits SuperclassImpl {
|
@ -23,54 +23,61 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.TargetInfoImpl;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
import static jdk.internal.classfile.Classfile.TAT_CAST;
|
||||
import static jdk.internal.classfile.Classfile.TAT_CLASS_EXTENDS;
|
||||
import static jdk.internal.classfile.Classfile.TAT_CLASS_TYPE_PARAMETER;
|
||||
import static jdk.internal.classfile.Classfile.TAT_CLASS_TYPE_PARAMETER_BOUND;
|
||||
import static jdk.internal.classfile.Classfile.TAT_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT;
|
||||
import static jdk.internal.classfile.Classfile.TAT_CONSTRUCTOR_REFERENCE;
|
||||
import static jdk.internal.classfile.Classfile.TAT_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT;
|
||||
import static jdk.internal.classfile.Classfile.TAT_EXCEPTION_PARAMETER;
|
||||
import static jdk.internal.classfile.Classfile.TAT_FIELD;
|
||||
import static jdk.internal.classfile.Classfile.TAT_INSTANCEOF;
|
||||
import static jdk.internal.classfile.Classfile.TAT_LOCAL_VARIABLE;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_FORMAL_PARAMETER;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_INVOCATION_TYPE_ARGUMENT;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_RECEIVER;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_REFERENCE;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_REFERENCE_TYPE_ARGUMENT;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_RETURN;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_TYPE_PARAMETER;
|
||||
import static jdk.internal.classfile.Classfile.TAT_METHOD_TYPE_PARAMETER_BOUND;
|
||||
import static jdk.internal.classfile.Classfile.TAT_NEW;
|
||||
import static jdk.internal.classfile.Classfile.TAT_RESOURCE_VARIABLE;
|
||||
import static jdk.internal.classfile.Classfile.TAT_THROWS;
|
||||
import static java.lang.classfile.ClassFile.TAT_CAST;
|
||||
import static java.lang.classfile.ClassFile.TAT_CLASS_EXTENDS;
|
||||
import static java.lang.classfile.ClassFile.TAT_CLASS_TYPE_PARAMETER;
|
||||
import static java.lang.classfile.ClassFile.TAT_CLASS_TYPE_PARAMETER_BOUND;
|
||||
import static java.lang.classfile.ClassFile.TAT_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT;
|
||||
import static java.lang.classfile.ClassFile.TAT_CONSTRUCTOR_REFERENCE;
|
||||
import static java.lang.classfile.ClassFile.TAT_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT;
|
||||
import static java.lang.classfile.ClassFile.TAT_EXCEPTION_PARAMETER;
|
||||
import static java.lang.classfile.ClassFile.TAT_FIELD;
|
||||
import static java.lang.classfile.ClassFile.TAT_INSTANCEOF;
|
||||
import static java.lang.classfile.ClassFile.TAT_LOCAL_VARIABLE;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_FORMAL_PARAMETER;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_INVOCATION_TYPE_ARGUMENT;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_RECEIVER;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_REFERENCE;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_REFERENCE_TYPE_ARGUMENT;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_RETURN;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_TYPE_PARAMETER;
|
||||
import static java.lang.classfile.ClassFile.TAT_METHOD_TYPE_PARAMETER_BOUND;
|
||||
import static java.lang.classfile.ClassFile.TAT_NEW;
|
||||
import static java.lang.classfile.ClassFile.TAT_RESOURCE_VARIABLE;
|
||||
import static java.lang.classfile.ClassFile.TAT_THROWS;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models an annotation on a type use, as defined in {@jvms 4.7.19} and {@jvms 4.7.20}.
|
||||
*
|
||||
* @see RuntimeVisibleTypeAnnotationsAttribute
|
||||
* @see RuntimeInvisibleTypeAnnotationsAttribute
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface TypeAnnotation
|
||||
extends Annotation
|
||||
permits UnboundAttribute.UnboundTypeAnnotation {
|
||||
|
||||
/**
|
||||
* The kind of target on which the annotation appears, as defined in {@jvms 4.7.20.1}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public enum TargetType {
|
||||
/** For annotations on a class type parameter declaration. */
|
||||
CLASS_TYPE_PARAMETER(TAT_CLASS_TYPE_PARAMETER, 1),
|
||||
@ -228,7 +235,11 @@ public sealed interface TypeAnnotation
|
||||
|
||||
/**
|
||||
* Specifies which type in a declaration or expression is being annotated.
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface TargetInfo {
|
||||
|
||||
/**
|
||||
@ -392,9 +403,9 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* {@return a target for annotations on the type in an instanceof expression or a new expression,
|
||||
* or the type before the :: in a method reference expression}
|
||||
* {@param targetType {@link TargetType#INSTANCEOF}, {@link TargetType#NEW},
|
||||
* {@link TargetType#CONSTRUCTOR_REFERENCE},
|
||||
* or {@link TargetType#METHOD_REFERENCE}}
|
||||
* @param targetType {@link TargetType#INSTANCEOF}, {@link TargetType#NEW},
|
||||
* {@link TargetType#CONSTRUCTOR_REFERENCE},
|
||||
* or {@link TargetType#METHOD_REFERENCE}
|
||||
* @param target the code label corresponding to the instruction
|
||||
*/
|
||||
static OffsetTarget ofOffset(TargetType targetType, Label target) {
|
||||
@ -438,10 +449,10 @@ public sealed interface TypeAnnotation
|
||||
* or on the i'th type argument in the explicit type argument list for any of the following:
|
||||
* a new expression, an explicit constructor invocation statement, a method invocation expression,
|
||||
* or a method reference expression}
|
||||
* {@param targetType {@link TargetType#CAST}, {@link TargetType#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT},
|
||||
* {@link TargetType#METHOD_INVOCATION_TYPE_ARGUMENT},
|
||||
* {@link TargetType#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT},
|
||||
* or {@link TargetType#METHOD_REFERENCE_TYPE_ARGUMENT}}
|
||||
* @param targetType {@link TargetType#CAST}, {@link TargetType#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT},
|
||||
* {@link TargetType#METHOD_INVOCATION_TYPE_ARGUMENT},
|
||||
* {@link TargetType#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT},
|
||||
* or {@link TargetType#METHOD_REFERENCE_TYPE_ARGUMENT}
|
||||
* @param target the code label corresponding to the instruction
|
||||
* @param typeArgumentIndex specifies which type in the cast operator or argument is annotated
|
||||
*/
|
||||
@ -503,7 +514,10 @@ public sealed interface TypeAnnotation
|
||||
* Indicates that an annotation appears on the declaration of the i'th type
|
||||
* parameter of a generic class, generic interface, generic method, or
|
||||
* generic constructor.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface TypeParameterTarget extends TargetInfo
|
||||
permits TargetInfoImpl.TypeParameterTargetImpl {
|
||||
|
||||
@ -519,7 +533,10 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* Indicates that an annotation appears on a type in the extends or implements
|
||||
* clause of a class or interface declaration.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface SupertypeTarget extends TargetInfo
|
||||
permits TargetInfoImpl.SupertypeTargetImpl {
|
||||
|
||||
@ -540,7 +557,10 @@ public sealed interface TypeAnnotation
|
||||
* Indicates that an annotation appears on the i'th bound of the j'th
|
||||
* type parameter declaration of a generic class, interface, method, or
|
||||
* constructor.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface TypeParameterBoundTarget extends TargetInfo
|
||||
permits TargetInfoImpl.TypeParameterBoundTargetImpl {
|
||||
|
||||
@ -563,7 +583,10 @@ public sealed interface TypeAnnotation
|
||||
* Indicates that an annotation appears on either the type in a field
|
||||
* declaration, the return type of a method, the type of a newly constructed
|
||||
* object, or the receiver type of a method or constructor.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface EmptyTarget extends TargetInfo
|
||||
permits TargetInfoImpl.EmptyTargetImpl {
|
||||
}
|
||||
@ -571,7 +594,10 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* Indicates that an annotation appears on the type in a formal parameter
|
||||
* declaration of a method, constructor, or lambda expression.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface FormalParameterTarget extends TargetInfo
|
||||
permits TargetInfoImpl.FormalParameterTargetImpl {
|
||||
|
||||
@ -587,7 +613,10 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* Indicates that an annotation appears on the i'th type in the throws
|
||||
* clause of a method or constructor declaration.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface ThrowsTarget extends TargetInfo
|
||||
permits TargetInfoImpl.ThrowsTargetImpl {
|
||||
|
||||
@ -596,7 +625,7 @@ public sealed interface TypeAnnotation
|
||||
* Exceptions attribute of the method_info structure enclosing the
|
||||
* RuntimeVisibleTypeAnnotations attribute.
|
||||
*
|
||||
* @return the index into the list jdk.internal.classfile.attribute.ExceptionsAttribute.exceptions()
|
||||
* @return the index into the list java.lang.classfile.attribute.ExceptionsAttribute.exceptions()
|
||||
*/
|
||||
int throwsTargetIndex();
|
||||
}
|
||||
@ -604,12 +633,15 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* Indicates that an annotation appears on the type in a local variable declaration,
|
||||
* including a variable declared as a resource in a try-with-resources statement.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface LocalVarTarget extends TargetInfo
|
||||
permits TargetInfoImpl.LocalVarTargetImpl {
|
||||
|
||||
/**
|
||||
* @return the table of local variable location/indices.
|
||||
* {@return the table of local variable location/indices.}
|
||||
*/
|
||||
List<LocalVarTargetInfo> table();
|
||||
}
|
||||
@ -618,7 +650,10 @@ public sealed interface TypeAnnotation
|
||||
* Indicates a range of code array offsets within which a local variable
|
||||
* has a value, and the index into the local variable array of the current
|
||||
* frame at which that local variable can be found.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface LocalVarTargetInfo
|
||||
permits TargetInfoImpl.LocalVarTargetInfoImpl {
|
||||
|
||||
@ -662,7 +697,10 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* Indicates that an annotation appears on the i'th type in an exception parameter
|
||||
* declaration.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface CatchTarget extends TargetInfo
|
||||
permits TargetInfoImpl.CatchTargetImpl {
|
||||
|
||||
@ -678,7 +716,10 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* Indicates that an annotation appears on either the type in an instanceof expression
|
||||
* or a new expression, or the type before the :: in a method reference expression.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface OffsetTarget extends TargetInfo
|
||||
permits TargetInfoImpl.OffsetTargetImpl {
|
||||
|
||||
@ -697,7 +738,10 @@ public sealed interface TypeAnnotation
|
||||
* expression, or on the i'th type argument in the explicit type argument list for any of the following: a new
|
||||
* expression, an explicit constructor invocation statement, a method invocation expression, or a method reference
|
||||
* expression.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface TypeArgumentTarget extends TargetInfo
|
||||
permits TargetInfoImpl.TypeArgumentTargetImpl {
|
||||
|
||||
@ -730,13 +774,19 @@ public sealed interface TypeAnnotation
|
||||
/**
|
||||
* JVMS: Type_path structure identifies which part of the type is annotated,
|
||||
* as defined in {@jvms 4.7.20.2}
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface TypePathComponent
|
||||
permits UnboundAttribute.TypePathComponentImpl {
|
||||
|
||||
/**
|
||||
* Type path kind, as defined in {@jvms 4.7.20.2}
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public enum Kind {
|
||||
|
||||
/** Annotation is deeper in an array type */
|
@ -23,13 +23,17 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.invoke.TypeDescriptor;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Describes the types that can be part of a field or method descriptor.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public enum TypeKind {
|
||||
/** the primitive type byte */
|
||||
ByteType("byte", "B", 8),
|
@ -22,20 +22,25 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile;
|
||||
package java.lang.classfile;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ConstantPoolBuilder;
|
||||
import jdk.internal.classfile.constantpool.PoolEntry;
|
||||
import java.lang.classfile.constantpool.ConstantPoolBuilder;
|
||||
import java.lang.classfile.constantpool.PoolEntry;
|
||||
import jdk.internal.classfile.impl.DirectFieldBuilder;
|
||||
import jdk.internal.classfile.impl.DirectMethodBuilder;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A classfile element that can encode itself as a stream of bytes in the
|
||||
* encoding expected by the classfile format.
|
||||
*
|
||||
* @param <T> the type of the entity
|
||||
*
|
||||
* @sealedGraph
|
||||
* @since 22
|
||||
*/
|
||||
public sealed interface WritableElement<T> extends ClassfileElement
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface WritableElement<T> extends ClassFileElement
|
||||
permits Annotation, AnnotationElement, AnnotationValue, Attribute,
|
||||
PoolEntry, BootstrapMethodEntry, FieldModel, MethodModel,
|
||||
ConstantPoolBuilder, DirectFieldBuilder, DirectMethodBuilder {
|
@ -23,14 +23,15 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.AnnotationValue;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import jdk.internal.classfile.MethodModel;
|
||||
import java.lang.classfile.AnnotationValue;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import java.lang.classfile.MethodModel;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code AnnotationDefault} attribute {@jvms 4.7.22}, which can
|
||||
@ -41,7 +42,12 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface AnnotationDefaultAttribute
|
||||
extends Attribute<AnnotationDefaultAttribute>, MethodElement
|
||||
permits BoundAttribute.BoundAnnotationDefaultAttr,
|
@ -23,15 +23,16 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.BootstrapMethodEntry;
|
||||
import jdk.internal.classfile.constantpool.ConstantPool;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.BootstrapMethodEntry;
|
||||
import java.lang.classfile.constantpool.ConstantPool;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code BootstrapMethods} attribute {@jvms 4.7.23}, which serves as
|
||||
@ -41,7 +42,12 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 7.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface BootstrapMethodsAttribute
|
||||
extends Attribute<BootstrapMethodsAttribute>
|
||||
permits BoundAttribute.BoundBootstrapMethodsAttribute,
|
@ -22,13 +22,17 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single character range in the {@link CharacterRangeTableAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CharacterRangeInfo
|
||||
permits UnboundAttribute.UnboundCharacterRangeInfo {
|
||||
|
||||
@ -66,17 +70,17 @@ public sealed interface CharacterRangeInfo
|
||||
* The value of the flags item describes the kind of range. Multiple flags
|
||||
* may be set within flags.
|
||||
* <ul>
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_STATEMENT} Range is a Statement
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_STATEMENT} Range is a Statement
|
||||
* (except ExpressionStatement), StatementExpression {@jls 14.8}, as well as each
|
||||
* VariableDeclaratorId = VariableInitializer of
|
||||
* LocalVariableDeclarationStatement {@jls 14.4} or FieldDeclaration {@jls 8.3} in the
|
||||
* grammar.
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_BLOCK} Range is a Block in the
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_BLOCK} Range is a Block in the
|
||||
* grammar.
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_ASSIGNMENT} Range is an assignment
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_ASSIGNMENT} Range is an assignment
|
||||
* expression - Expression1 AssignmentOperator Expression1 in the grammar as
|
||||
* well as increment and decrement expressions (both prefix and postfix).
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_FLOW_CONTROLLER} An expression
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_CONTROLLER} An expression
|
||||
* whose value will effect control flow. {@code Flowcon} in the following:
|
||||
* <pre>
|
||||
* if ( Flowcon ) Statement [else Statement]
|
||||
@ -88,7 +92,7 @@ public sealed interface CharacterRangeInfo
|
||||
* Flowcon && Expression3
|
||||
* Flowcon ? Expression : Expression1
|
||||
* </pre>
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_FLOW_TARGET} Statement or
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_TARGET} Statement or
|
||||
* expression effected by a CRT_FLOW_CONTROLLER. {@code Flowtarg} in the following:
|
||||
* <pre>
|
||||
* if ( Flowcon ) Flowtarg [else Flowtarg]
|
||||
@ -99,11 +103,11 @@ public sealed interface CharacterRangeInfo
|
||||
* Flowcon && Flowtarg
|
||||
* Flowcon ? Flowtarg : Flowtarg
|
||||
* </pre>
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_INVOKE} Method invocation. For
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_INVOKE} Method invocation. For
|
||||
* example: Identifier Arguments.
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_CREATE} New object creation. For
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_CREATE} New object creation. For
|
||||
* example: new Creator.
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_BRANCH_TRUE} A condition encoded
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_TRUE} A condition encoded
|
||||
* in the branch instruction immediately contained in the code range for
|
||||
* this item is not inverted towards the corresponding branch condition in
|
||||
* the source code. I.e. actual jump occurs if and only if the the source
|
||||
@ -115,7 +119,7 @@ public sealed interface CharacterRangeInfo
|
||||
* if<cond>, ifnonull, ifnull or goto. CRT_BRANCH_TRUE and
|
||||
* CRT_BRANCH_FALSE are special kinds of entries that can be used to
|
||||
* determine what branch of a condition was chosen during the runtime.
|
||||
* <li>{@link jdk.internal.classfile.Classfile#CRT_BRANCH_FALSE} A condition encoded
|
||||
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_FALSE} A condition encoded
|
||||
* in the branch instruction immediately contained in the code range for
|
||||
* this item is inverted towards the corresponding branch condition in the
|
||||
* source code. I.e. actual jump occurs if and only if the the source code
|
@ -23,13 +23,14 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import java.lang.classfile.Attribute;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* The CharacterRangeTable attribute is an optional variable-length attribute in
|
||||
@ -56,7 +57,10 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* index range. The character range entries may appear in any order.
|
||||
* <p>
|
||||
* The attribute permits multiple instances in a given location.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CharacterRangeTableAttribute
|
||||
extends Attribute<CharacterRangeTableAttribute>
|
||||
permits BoundAttribute.BoundCharacterRangeTableAttribute,
|
@ -23,23 +23,27 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.CodeModel;
|
||||
import jdk.internal.classfile.Label;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.CodeModel;
|
||||
import java.lang.classfile.Label;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code Code} attribute {@jvms 4.7.3}, appears on non-native,
|
||||
* non-abstract methods and contains the bytecode of the method body. Delivered
|
||||
* as a {@link jdk.internal.classfile.MethodElement} when traversing the elements of a
|
||||
* {@link jdk.internal.classfile.MethodModel}.
|
||||
* as a {@link java.lang.classfile.MethodElement} when traversing the elements of a
|
||||
* {@link java.lang.classfile.MethodModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CodeAttribute extends Attribute<CodeAttribute>, CodeModel
|
||||
permits BoundAttribute.BoundCodeAttribute {
|
||||
|
@ -23,25 +23,29 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code CompilationID} attribute (@@@ need reference), which can
|
||||
* appear on classes and records the compilation time of the class. Delivered
|
||||
* as a {@link jdk.internal.classfile.ClassElement} when traversing the elements of
|
||||
* a {@link jdk.internal.classfile.ClassModel}.
|
||||
* as a {@link java.lang.classfile.ClassElement} when traversing the elements of
|
||||
* a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface CompilationIDAttribute
|
||||
extends Attribute<CompilationIDAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundCompilationIDAttribute,
|
@ -22,26 +22,30 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ConstantDesc;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.FieldElement;
|
||||
import jdk.internal.classfile.constantpool.ConstantValueEntry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.FieldElement;
|
||||
import java.lang.classfile.constantpool.ConstantValueEntry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code ConstantValue} attribute {@jvms 4.7.2}, which can appear on
|
||||
* fields and indicates that the field's value is a constant. Delivered as a
|
||||
* {@link jdk.internal.classfile.FieldElement} when traversing the elements of a
|
||||
* {@link jdk.internal.classfile.FieldModel}.
|
||||
* {@link java.lang.classfile.FieldElement} when traversing the elements of a
|
||||
* {@link java.lang.classfile.FieldModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ConstantValueAttribute
|
||||
extends Attribute<ConstantValueAttribute>, FieldElement
|
||||
permits BoundAttribute.BoundConstantValueAttribute,
|
@ -22,14 +22,15 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.FieldElement;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.FieldElement;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code Deprecated} attribute {@jvms 4.7.15}, which can appear on
|
||||
@ -38,7 +39,10 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* of a corresponding model.
|
||||
* <p>
|
||||
* The attribute permits multiple instances in a given location.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface DeprecatedAttribute
|
||||
extends Attribute<DeprecatedAttribute>,
|
||||
ClassElement, MethodElement, FieldElement
|
@ -22,32 +22,38 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.lang.constant.MethodTypeDesc;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.constantpool.NameAndTypeEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.NameAndTypeEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code EnclosingMethod} attribute {@jvms 4.7.7}, which can appear
|
||||
* on classes, and indicates that the class is a local or anonymous class.
|
||||
* Delivered as a {@link ClassElement} when traversing the elements of a {@link
|
||||
* jdk.internal.classfile.ClassModel}.
|
||||
* java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface EnclosingMethodAttribute
|
||||
extends Attribute<EnclosingMethodAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundEnclosingMethodAttribute,
|
||||
@ -92,7 +98,8 @@ public sealed interface EnclosingMethodAttribute
|
||||
/**
|
||||
* {@return an {@code EnclosingMethod} attribute}
|
||||
* @param className the class name
|
||||
* @param method the name and type of the enclosing method
|
||||
* @param method the name and type of the enclosing method or {@code empty} if
|
||||
* the class is not immediately enclosed by a method or constructor
|
||||
*/
|
||||
static EnclosingMethodAttribute of(ClassEntry className,
|
||||
Optional<NameAndTypeEntry> method) {
|
||||
@ -102,8 +109,11 @@ public sealed interface EnclosingMethodAttribute
|
||||
/**
|
||||
* {@return an {@code EnclosingMethod} attribute}
|
||||
* @param className the class name
|
||||
* @param methodName the name of the enclosing method
|
||||
* @param methodType the type of the enclosing method
|
||||
* @param methodName the name of the enclosing method or {@code empty} if
|
||||
* the class is not immediately enclosed by a method or constructor
|
||||
* @param methodType the type of the enclosing method or {@code empty} if
|
||||
* the class is not immediately enclosed by a method or constructor
|
||||
* @throws IllegalArgumentException if {@code className} represents a primitive type
|
||||
*/
|
||||
static EnclosingMethodAttribute of(ClassDesc className,
|
||||
Optional<String> methodName,
|
@ -22,29 +22,33 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code Exceptions} attribute {@jvms 4.7.5}, which can appear on
|
||||
* methods, and records the exceptions declared to be thrown by this method.
|
||||
* Delivered as a {@link MethodElement} when traversing the elements of a
|
||||
* {@link jdk.internal.classfile.MethodModel}.
|
||||
* {@link java.lang.classfile.MethodModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ExceptionsAttribute
|
||||
extends Attribute<ExceptionsAttribute>, MethodElement
|
||||
permits BoundAttribute.BoundExceptionsAttribute,
|
@ -22,23 +22,27 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single inner class in the {@link InnerClassesAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface InnerClassInfo
|
||||
permits UnboundAttribute.UnboundInnerClassInfo {
|
||||
|
||||
@ -98,6 +102,7 @@ public sealed interface InnerClassInfo
|
||||
* @param outerClass the class containing the inner class, if any
|
||||
* @param innerName the name of the inner class, if it is not anonymous
|
||||
* @param flags the inner class access flags
|
||||
* @throws IllegalArgumentException if {@code innerClass} or {@code outerClass} represents a primitive type
|
||||
*/
|
||||
static InnerClassInfo of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, int flags) {
|
||||
return new UnboundAttribute.UnboundInnerClassInfo(TemporaryConstantPool.INSTANCE.classEntry(innerClass),
|
||||
@ -112,6 +117,7 @@ public sealed interface InnerClassInfo
|
||||
* @param outerClass the class containing the inner class, if any
|
||||
* @param innerName the name of the inner class, if it is not anonymous
|
||||
* @param flags the inner class access flags
|
||||
* @throws IllegalArgumentException if {@code innerClass} or {@code outerClass} represents a primitive type
|
||||
*/
|
||||
static InnerClassInfo of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, AccessFlag... flags) {
|
||||
return of(innerClass, outerClass, innerName, Util.flagsToBits(AccessFlag.Location.INNER_CLASS, flags));
|
@ -23,25 +23,29 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code InnerClasses} attribute {@jvms 4.7.6}, which can
|
||||
* appear on classes, and records which classes referenced by this classfile
|
||||
* are inner classes. Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* are inner classes. Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface InnerClassesAttribute
|
||||
extends Attribute<InnerClassesAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundInnerClassesAttribute,
|
@ -22,13 +22,17 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single line number in the {@link LineNumberTableAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface LineNumberInfo
|
||||
permits UnboundAttribute.UnboundLineNumberInfo {
|
||||
|
@ -22,24 +22,28 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import java.lang.classfile.Attribute;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code LineNumberTable} attribute {@jvms 4.7.12}, which can appear
|
||||
* on a {@code Code} attribute, and records the mapping between indexes into
|
||||
* the code table and line numbers in the source file.
|
||||
* Delivered as a {@link jdk.internal.classfile.instruction.LineNumber} when traversing the
|
||||
* elements of a {@link jdk.internal.classfile.CodeModel}, according to the setting of the
|
||||
* {@link jdk.internal.classfile.Classfile.LineNumbersOption} option.
|
||||
* Delivered as a {@link java.lang.classfile.instruction.LineNumber} when traversing the
|
||||
* elements of a {@link java.lang.classfile.CodeModel}, according to the setting of the
|
||||
* {@link java.lang.classfile.ClassFile.LineNumbersOption} option.
|
||||
* <p>
|
||||
* The attribute permits multiple instances in a given location.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface LineNumberTableAttribute
|
||||
extends Attribute<LineNumberTableAttribute>
|
||||
permits BoundAttribute.BoundLineNumberTableAttribute,
|
@ -22,16 +22,20 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundLocalVariable;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single local variable in the {@link LocalVariableTableAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface LocalVariableInfo
|
||||
permits UnboundAttribute.UnboundLocalVariableInfo, BoundLocalVariable {
|
||||
|
@ -22,24 +22,28 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import java.lang.classfile.Attribute;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
import java.util.List;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code LocalVariableTable} attribute {@jvms 4.7.13}, which can appear
|
||||
* on a {@code Code} attribute, and records debug information about local
|
||||
* variables.
|
||||
* Delivered as a {@link jdk.internal.classfile.instruction.LocalVariable} when traversing the
|
||||
* elements of a {@link jdk.internal.classfile.CodeModel}, according to the setting of the
|
||||
* {@link jdk.internal.classfile.Classfile.DebugElementsOption} option.
|
||||
* Delivered as a {@link java.lang.classfile.instruction.LocalVariable} when traversing the
|
||||
* elements of a {@link java.lang.classfile.CodeModel}, according to the setting of the
|
||||
* {@link java.lang.classfile.ClassFile.DebugElementsOption} option.
|
||||
* <p>
|
||||
* The attribute permits multiple instances in a given location.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface LocalVariableTableAttribute
|
||||
extends Attribute<LocalVariableTableAttribute>
|
||||
permits BoundAttribute.BoundLocalVariableTableAttribute, UnboundAttribute.UnboundLocalVariableTableAttribute {
|
@ -22,15 +22,19 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundLocalVariableType;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single local variable in the {@link LocalVariableTypeTableAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface LocalVariableTypeInfo
|
||||
permits UnboundAttribute.UnboundLocalVariableTypeInfo, BoundLocalVariableType {
|
||||
|
@ -23,24 +23,30 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import java.lang.classfile.Attribute;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
import java.util.List;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code LocalVariableTypeTable} attribute {@jvms 4.7.14}, which can appear
|
||||
* on a {@code Code} attribute, and records debug information about local
|
||||
* variables.
|
||||
* Delivered as a {@link jdk.internal.classfile.instruction.LocalVariable} when traversing the
|
||||
* elements of a {@link jdk.internal.classfile.CodeModel}, according to the setting of the
|
||||
* {@link jdk.internal.classfile.Classfile.LineNumbersOption} option.
|
||||
* Delivered as a {@link java.lang.classfile.instruction.LocalVariable} when traversing the
|
||||
* elements of a {@link java.lang.classfile.CodeModel}, according to the setting of the
|
||||
* {@link java.lang.classfile.ClassFile.LineNumbersOption} option.
|
||||
* <p>
|
||||
* The attribute permits multiple instances in a given location.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface LocalVariableTypeTableAttribute
|
||||
extends Attribute<LocalVariableTypeTableAttribute>
|
||||
permits BoundAttribute.BoundLocalVariableTypeTableAttribute, UnboundAttribute.UnboundLocalVariableTypeTableAttribute {
|
@ -22,21 +22,25 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
import jdk.internal.classfile.Classfile;
|
||||
import java.lang.classfile.ClassFile;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single method parameter in the {@link MethodParametersAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface MethodParameterInfo
|
||||
permits UnboundAttribute.UnboundMethodParameterInfo {
|
||||
/**
|
||||
@ -48,8 +52,8 @@ public sealed interface MethodParameterInfo
|
||||
|
||||
/**
|
||||
* Parameter access flags for this parameter, as a bit mask. Valid
|
||||
* parameter flags include {@link Classfile#ACC_FINAL},
|
||||
* {@link Classfile#ACC_SYNTHETIC}, and {@link Classfile#ACC_MANDATED}.
|
||||
* parameter flags include {@link ClassFile#ACC_FINAL},
|
||||
* {@link ClassFile#ACC_SYNTHETIC}, and {@link ClassFile#ACC_MANDATED}.
|
||||
*
|
||||
* @return the access flags, as a bit mask
|
||||
*/
|
@ -23,25 +23,31 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code MethodParameters} attribute {@jvms 4.7.24}, which can
|
||||
* appear on methods, and records optional information about the method's
|
||||
* parameters. Delivered as a {@link jdk.internal.classfile.MethodElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.MethodModel}.
|
||||
* parameters. Delivered as a {@link java.lang.classfile.MethodElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.MethodModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 8.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface MethodParametersAttribute
|
||||
extends Attribute<MethodParametersAttribute>, MethodElement
|
||||
permits BoundAttribute.BoundMethodParametersAttribute,
|
@ -22,15 +22,15 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Collection;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.constantpool.ModuleEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.ModuleEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
@ -43,18 +43,23 @@ import java.lang.constant.ModuleDesc;
|
||||
import java.lang.constant.PackageDesc;
|
||||
import jdk.internal.classfile.impl.ModuleAttributeBuilderImpl;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code Module} attribute {@jvms 4.7.25}, which can
|
||||
* appear on classes that represent module descriptors.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 9.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleAttribute
|
||||
extends Attribute<ModuleAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundModuleAttribute, UnboundAttribute.UnboundModuleAttribute {
|
||||
@ -166,7 +171,10 @@ public sealed interface ModuleAttribute
|
||||
|
||||
/**
|
||||
* A builder for module attributes.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleAttributeBuilder
|
||||
permits ModuleAttributeBuilderImpl {
|
||||
|
||||
@ -255,7 +263,7 @@ public sealed interface ModuleAttribute
|
||||
ModuleAttributeBuilder exports(ModuleExportInfo exports);
|
||||
|
||||
/**
|
||||
*
|
||||
* Opens package
|
||||
* @param pkge the opened package
|
||||
* @param opensFlagsMask the open package flags
|
||||
* @param opensToModules the modules to open to
|
||||
@ -264,7 +272,7 @@ public sealed interface ModuleAttribute
|
||||
ModuleAttributeBuilder opens(PackageDesc pkge, int opensFlagsMask, ModuleDesc... opensToModules);
|
||||
|
||||
/**
|
||||
*
|
||||
* Opens package
|
||||
* @param pkge the opened package
|
||||
* @param opensFlags the open package flags
|
||||
* @param opensToModules the modules to open to
|
||||
@ -285,6 +293,7 @@ public sealed interface ModuleAttribute
|
||||
* Declares use of a service
|
||||
* @param service the service class used
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code service} represents a primitive type
|
||||
*/
|
||||
ModuleAttributeBuilder uses(ClassDesc service);
|
||||
|
||||
@ -300,6 +309,7 @@ public sealed interface ModuleAttribute
|
||||
* @param service the service class provided
|
||||
* @param implClasses the implementation classes
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if {@code service} or any of the {@code implClasses} represents a primitive type
|
||||
*/
|
||||
ModuleAttributeBuilder provides(ClassDesc service, ClassDesc... implClasses);
|
||||
|
@ -22,26 +22,30 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ModuleEntry;
|
||||
import jdk.internal.classfile.constantpool.PackageEntry;
|
||||
import java.lang.classfile.constantpool.ModuleEntry;
|
||||
import java.lang.classfile.constantpool.PackageEntry;
|
||||
import java.lang.constant.ModuleDesc;
|
||||
import java.lang.constant.PackageDesc;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
|
||||
import jdk.internal.classfile.Classfile;
|
||||
import java.lang.classfile.ClassFile;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single "exports" declaration in the {@link ModuleAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleExportInfo
|
||||
permits UnboundAttribute.UnboundModuleExportInfo {
|
||||
|
||||
@ -52,8 +56,8 @@ public sealed interface ModuleExportInfo
|
||||
|
||||
/**
|
||||
* {@return the flags associated with this export declaration, as a bit mask}
|
||||
* Valid flags include {@link Classfile#ACC_SYNTHETIC} and
|
||||
* {@link Classfile#ACC_MANDATED}.
|
||||
* Valid flags include {@link ClassFile#ACC_SYNTHETIC} and
|
||||
* {@link ClassFile#ACC_MANDATED}.
|
||||
*/
|
||||
int exportsFlagsMask();
|
||||
|
@ -22,16 +22,20 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ModuleEntry;
|
||||
import java.lang.classfile.constantpool.ModuleEntry;
|
||||
import java.lang.constant.ModuleDesc;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models hash information for a single module in the {@link ModuleHashesAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleHashInfo
|
||||
permits UnboundAttribute.UnboundModuleHashInfo {
|
||||
|
@ -23,24 +23,25 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code ModuleHashes} attribute, which can
|
||||
* appear on classes that represent module descriptors. This is a JDK-specific
|
||||
* attribute, which captures the hashes of a set of co-delivered modules.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
*
|
||||
* <p>The specification of the {@code ModuleHashes} attribute is:
|
||||
* <pre> {@code
|
||||
@ -67,7 +68,10 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleHashesAttribute
|
||||
extends Attribute<ModuleHashesAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundModuleHashesAttribute, UnboundAttribute.UnboundModuleHashesAttribute {
|
@ -23,26 +23,32 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code ModuleMainClass} attribute {@jvms 4.7.27}, which can
|
||||
* appear on classes that represent module descriptors.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 9.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleMainClassAttribute
|
||||
extends Attribute<ModuleMainClassAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundModuleMainClassAttribute, UnboundAttribute.UnboundModuleMainClassAttribute {
|
||||
@ -63,6 +69,7 @@ public sealed interface ModuleMainClassAttribute
|
||||
/**
|
||||
* {@return a {@code ModuleMainClass} attribute}
|
||||
* @param mainClass the main class
|
||||
* @throws IllegalArgumentException if {@code mainClass} represents a primitive type
|
||||
*/
|
||||
static ModuleMainClassAttribute of(ClassDesc mainClass) {
|
||||
return new UnboundAttribute.UnboundModuleMainClassAttribute(TemporaryConstantPool.INSTANCE.classEntry(mainClass));
|
@ -22,14 +22,14 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ModuleEntry;
|
||||
import jdk.internal.classfile.constantpool.PackageEntry;
|
||||
import java.lang.classfile.constantpool.ModuleEntry;
|
||||
import java.lang.classfile.constantpool.PackageEntry;
|
||||
import java.lang.constant.ModuleDesc;
|
||||
import java.lang.constant.PackageDesc;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
@ -37,10 +37,14 @@ import java.lang.reflect.AccessFlag;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single "opens" declaration in the {@link ModuleAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleOpenInfo
|
||||
permits UnboundAttribute.UnboundModuleOpenInfo {
|
||||
|
||||
@ -51,8 +55,8 @@ public sealed interface ModuleOpenInfo
|
||||
|
||||
/**
|
||||
* {@return the flags associated with this open declaration, as a bit mask}
|
||||
* Valid flags include {@link jdk.internal.classfile.Classfile#ACC_SYNTHETIC} and
|
||||
* {@link jdk.internal.classfile.Classfile#ACC_MANDATED}
|
||||
* Valid flags include {@link java.lang.classfile.ClassFile#ACC_SYNTHETIC} and
|
||||
* {@link java.lang.classfile.ClassFile#ACC_MANDATED}
|
||||
*/
|
||||
int opensFlagsMask();
|
||||
|
@ -22,30 +22,36 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.constantpool.PackageEntry;
|
||||
import java.lang.classfile.constantpool.PackageEntry;
|
||||
import java.lang.constant.PackageDesc;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code ModulePackages} attribute {@jvms 4.7.26}, which can
|
||||
* appear on classes that represent module descriptors.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 9.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModulePackagesAttribute
|
||||
extends Attribute<ModulePackagesAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundModulePackagesAttribute,
|
@ -22,20 +22,24 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single "provides" declaration in the {@link ModuleAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleProvideInfo
|
||||
permits UnboundAttribute.UnboundModuleProvideInfo {
|
||||
|
||||
@ -73,6 +77,7 @@ public sealed interface ModuleProvideInfo
|
||||
* {@return a service provision description}
|
||||
* @param provides the service class interface
|
||||
* @param providesWith the service class implementations
|
||||
* @throws IllegalArgumentException if {@code provides} represents a primitive type
|
||||
*/
|
||||
static ModuleProvideInfo of(ClassDesc provides,
|
||||
List<ClassDesc> providesWith) {
|
||||
@ -83,6 +88,7 @@ public sealed interface ModuleProvideInfo
|
||||
* {@return a service provision description}
|
||||
* @param provides the service class interface
|
||||
* @param providesWith the service class implementations
|
||||
* @throws IllegalArgumentException if {@code provides} or any of {@code providesWith} represents a primitive type
|
||||
*/
|
||||
static ModuleProvideInfo of(ClassDesc provides,
|
||||
ClassDesc... providesWith) {
|
@ -22,23 +22,27 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.classfile.constantpool.ModuleEntry;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.constantpool.ModuleEntry;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.reflect.AccessFlag;
|
||||
import java.lang.constant.ModuleDesc;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single "requires" declaration in the {@link ModuleAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleRequireInfo
|
||||
permits UnboundAttribute.UnboundModuleRequiresInfo {
|
||||
|
||||
@ -49,10 +53,10 @@ public sealed interface ModuleRequireInfo
|
||||
|
||||
/**
|
||||
* {@return the flags associated with this require declaration, as a bit mask}
|
||||
* Valid flags include {@link jdk.internal.classfile.Classfile#ACC_TRANSITIVE},
|
||||
* {@link jdk.internal.classfile.Classfile#ACC_STATIC_PHASE},
|
||||
* {@link jdk.internal.classfile.Classfile#ACC_SYNTHETIC} and
|
||||
* {@link jdk.internal.classfile.Classfile#ACC_MANDATED}
|
||||
* Valid flags include {@link java.lang.classfile.ClassFile#ACC_TRANSITIVE},
|
||||
* {@link java.lang.classfile.ClassFile#ACC_STATIC_PHASE},
|
||||
* {@link java.lang.classfile.ClassFile#ACC_SYNTHETIC} and
|
||||
* {@link java.lang.classfile.ClassFile#ACC_MANDATED}
|
||||
*/
|
||||
int requiresFlagsMask();
|
||||
|
@ -23,19 +23,20 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code ModuleResolution} attribute, which can
|
||||
* appear on classes that represent module descriptors. This is a JDK-specific
|
||||
* * attribute, which captures resolution metadata for modules.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
*
|
||||
* <p>The specification of the {@code ModuleResolution} attribute is:
|
||||
* <pre> {@code
|
||||
@ -60,7 +61,10 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleResolutionAttribute
|
||||
extends Attribute<ModuleResolutionAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundModuleResolutionAttribute, UnboundAttribute.UnboundModuleResolutionAttribute {
|
||||
@ -68,7 +72,7 @@ public sealed interface ModuleResolutionAttribute
|
||||
/**
|
||||
* The value of the resolution_flags item is a mask of flags used to denote
|
||||
* properties of module resolution. The flags are as follows:
|
||||
*
|
||||
* <pre> {@code
|
||||
* // Optional
|
||||
* 0x0001 (DO_NOT_RESOLVE_BY_DEFAULT)
|
||||
*
|
||||
@ -76,6 +80,7 @@ public sealed interface ModuleResolutionAttribute
|
||||
* 0x0002 (WARN_DEPRECATED)
|
||||
* 0x0004 (WARN_DEPRECATED_FOR_REMOVAL)
|
||||
* 0x0008 (WARN_INCUBATING)
|
||||
* } </pre>
|
||||
* @return the module resolution flags
|
||||
*/
|
||||
int resolutionFlags();
|
@ -23,21 +23,22 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code ModuleTarget} attribute, which can
|
||||
* appear on classes that represent module descriptors. This is a JDK-specific
|
||||
* attribute, which captures constraints on the target platform.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
*
|
||||
* <p>The specification of the {@code ModuleTarget} attribute is:
|
||||
* <pre> {@code
|
||||
@ -55,7 +56,10 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface ModuleTargetAttribute
|
||||
extends Attribute<ModuleTargetAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundModuleTargetAttribute, UnboundAttribute.UnboundModuleTargetAttribute {
|
@ -23,26 +23,32 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code NestHost} attribute {@jvms 4.7.28}, which can
|
||||
* appear on classes to indicate that this class is a member of a nest.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 11.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface NestHostAttribute extends Attribute<NestHostAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundNestHostAttribute,
|
||||
UnboundAttribute.UnboundNestHostAttribute {
|
||||
@ -63,6 +69,7 @@ public sealed interface NestHostAttribute extends Attribute<NestHostAttribute>,
|
||||
/**
|
||||
* {@return a {@code NestHost} attribute}
|
||||
* @param nestHost the host class of the nest
|
||||
* @throws IllegalArgumentException if {@code nestHost} represents a primitive type
|
||||
*/
|
||||
static NestHostAttribute of(ClassDesc nestHost) {
|
||||
return of(TemporaryConstantPool.INSTANCE.classEntry(nestHost));
|
@ -22,29 +22,35 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code NestMembers} attribute {@jvms 4.7.29}, which can
|
||||
* appear on classes to indicate that this class is the host of a nest.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 11.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface NestMembersAttribute extends Attribute<NestMembersAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundNestMembersAttribute, UnboundAttribute.UnboundNestMembersAttribute {
|
||||
|
@ -22,29 +22,35 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.classfile.impl.Util;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code PermittedSubclasses} attribute {@jvms 4.7.31}, which can
|
||||
* appear on classes to indicate which classes may extend this class.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 17.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface PermittedSubclassesAttribute
|
||||
extends Attribute<PermittedSubclassesAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundPermittedSubclassesAttribute, UnboundAttribute.UnboundPermittedSubclassesAttribute {
|
@ -23,25 +23,31 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code Record} attribute {@jvms 4.7.30}, which can
|
||||
* appear on classes to indicate that this class is a record class.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 16.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RecordAttribute extends Attribute<RecordAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundRecordAttribute, UnboundAttribute.UnboundRecordAttribute {
|
||||
|
@ -22,21 +22,25 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.AttributedElement;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.AttributedElement;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundRecordComponentInfo;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models a single record component in the {@link jdk.internal.classfile.attribute.RecordAttribute}.
|
||||
* Models a single record component in the {@link java.lang.classfile.attribute.RecordAttribute}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RecordComponentInfo
|
||||
extends AttributedElement
|
||||
permits BoundRecordComponentInfo, UnboundAttribute.UnboundRecordComponentInfo {
|
@ -23,24 +23,30 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.*;
|
||||
import java.lang.classfile.*;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
import java.util.List;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code RuntimeInvisibleAnnotations} attribute {@jvms 4.7.17}, which
|
||||
* can appear on classes, methods, and fields. Delivered as a
|
||||
* {@link jdk.internal.classfile.ClassElement}, {@link jdk.internal.classfile.FieldElement}, or
|
||||
* {@link jdk.internal.classfile.MethodElement} when traversing the corresponding model type.
|
||||
* {@link java.lang.classfile.ClassElement}, {@link java.lang.classfile.FieldElement}, or
|
||||
* {@link java.lang.classfile.MethodElement} when traversing the corresponding model type.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RuntimeInvisibleAnnotationsAttribute
|
||||
extends Attribute<RuntimeInvisibleAnnotationsAttribute>,
|
||||
ClassElement, MethodElement, FieldElement
|
@ -23,26 +23,32 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Annotation;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import jdk.internal.classfile.MethodModel;
|
||||
import java.lang.classfile.Annotation;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import java.lang.classfile.MethodModel;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code RuntimeInvisibleParameterAnnotations} attribute
|
||||
* {@jvms 4.7.19}, which can appear on methods. Delivered as a {@link
|
||||
* jdk.internal.classfile.MethodElement} when traversing a {@link MethodModel}.
|
||||
* java.lang.classfile.MethodElement} when traversing a {@link MethodModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RuntimeInvisibleParameterAnnotationsAttribute
|
||||
extends Attribute<RuntimeInvisibleParameterAnnotationsAttribute>, MethodElement
|
||||
permits BoundAttribute.BoundRuntimeInvisibleParameterAnnotationsAttribute,
|
@ -23,30 +23,36 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.CodeElement;
|
||||
import jdk.internal.classfile.FieldElement;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import jdk.internal.classfile.TypeAnnotation;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.CodeElement;
|
||||
import java.lang.classfile.FieldElement;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import java.lang.classfile.TypeAnnotation;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code RuntimeInvisibleTypeAnnotations} attribute {@jvms 4.7.21}, which
|
||||
* can appear on classes, methods, fields, and code attributes. Delivered as a
|
||||
* {@link jdk.internal.classfile.ClassElement}, {@link jdk.internal.classfile.FieldElement},
|
||||
* {@link jdk.internal.classfile.MethodElement}, or {@link CodeElement} when traversing
|
||||
* {@link java.lang.classfile.ClassElement}, {@link java.lang.classfile.FieldElement},
|
||||
* {@link java.lang.classfile.MethodElement}, or {@link CodeElement} when traversing
|
||||
* the corresponding model type.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 8.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RuntimeInvisibleTypeAnnotationsAttribute
|
||||
extends Attribute<RuntimeInvisibleTypeAnnotationsAttribute>,
|
||||
ClassElement, MethodElement, FieldElement, CodeElement
|
@ -23,24 +23,30 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.*;
|
||||
import java.lang.classfile.*;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
|
||||
import java.util.List;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code RuntimeVisibleAnnotations} attribute {@jvms 4.7.16}, which
|
||||
* can appear on classes, methods, and fields. Delivered as a
|
||||
* {@link jdk.internal.classfile.ClassElement}, {@link jdk.internal.classfile.FieldElement}, or
|
||||
* {@link jdk.internal.classfile.MethodElement} when traversing the corresponding model type.
|
||||
* {@link java.lang.classfile.ClassElement}, {@link java.lang.classfile.FieldElement}, or
|
||||
* {@link java.lang.classfile.MethodElement} when traversing the corresponding model type.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RuntimeVisibleAnnotationsAttribute
|
||||
extends Attribute<RuntimeVisibleAnnotationsAttribute>,
|
||||
ClassElement, MethodElement, FieldElement
|
@ -23,26 +23,32 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Annotation;
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import jdk.internal.classfile.MethodModel;
|
||||
import java.lang.classfile.Annotation;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import java.lang.classfile.MethodModel;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code RuntimeVisibleParameterAnnotations} attribute {@jvms 4.7.18}, which
|
||||
* can appear on methods. Delivered as a {@link jdk.internal.classfile.MethodElement}
|
||||
* can appear on methods. Delivered as a {@link java.lang.classfile.MethodElement}
|
||||
* when traversing a {@link MethodModel}.
|
||||
*
|
||||
* @apiNote The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RuntimeVisibleParameterAnnotationsAttribute
|
||||
extends Attribute<RuntimeVisibleParameterAnnotationsAttribute>, MethodElement
|
||||
permits BoundAttribute.BoundRuntimeVisibleParameterAnnotationsAttribute,
|
@ -23,30 +23,36 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.CodeElement;
|
||||
import jdk.internal.classfile.FieldElement;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import jdk.internal.classfile.TypeAnnotation;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.CodeElement;
|
||||
import java.lang.classfile.FieldElement;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import java.lang.classfile.TypeAnnotation;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code RuntimeVisibleTypeAnnotations} attribute {@jvms 4.7.20}, which
|
||||
* can appear on classes, methods, fields, and code attributes. Delivered as a
|
||||
* {@link jdk.internal.classfile.ClassElement}, {@link jdk.internal.classfile.FieldElement},
|
||||
* {@link jdk.internal.classfile.MethodElement}, or {@link CodeElement} when traversing
|
||||
* {@link java.lang.classfile.ClassElement}, {@link java.lang.classfile.FieldElement},
|
||||
* {@link java.lang.classfile.MethodElement}, or {@link CodeElement} when traversing
|
||||
* the corresponding model type.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 8.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface RuntimeVisibleTypeAnnotationsAttribute
|
||||
extends Attribute<RuntimeVisibleTypeAnnotationsAttribute>,
|
||||
ClassElement, MethodElement, FieldElement, CodeElement
|
@ -23,31 +23,37 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.ClassSignature;
|
||||
import jdk.internal.classfile.FieldElement;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.ClassSignature;
|
||||
import java.lang.classfile.FieldElement;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.MethodSignature;
|
||||
import jdk.internal.classfile.Signature;
|
||||
import java.lang.classfile.MethodSignature;
|
||||
import java.lang.classfile.Signature;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code Signature} attribute {@jvms 4.7.9}, which
|
||||
* can appear on classes, methods, or fields. Delivered as a
|
||||
* {@link jdk.internal.classfile.ClassElement}, {@link jdk.internal.classfile.FieldElement}, or
|
||||
* {@link jdk.internal.classfile.MethodElement} when traversing
|
||||
* {@link java.lang.classfile.ClassElement}, {@link java.lang.classfile.FieldElement}, or
|
||||
* {@link java.lang.classfile.MethodElement} when traversing
|
||||
* the corresponding model type.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface SignatureAttribute
|
||||
extends Attribute<SignatureAttribute>,
|
||||
ClassElement, MethodElement, FieldElement
|
@ -23,22 +23,28 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code SourceDebugExtension} attribute.
|
||||
* Delivered as a {@link jdk.internal.classfile.ClassElement} when traversing the elements of
|
||||
* a {@link jdk.internal.classfile.ClassModel}.
|
||||
* Delivered as a {@link java.lang.classfile.ClassElement} when traversing the elements of
|
||||
* a {@link java.lang.classfile.ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 5.0.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface SourceDebugExtensionAttribute
|
||||
extends Attribute<SourceDebugExtensionAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundSourceDebugExtensionAttribute, UnboundAttribute.UnboundSourceDebugExtensionAttribute {
|
@ -23,25 +23,29 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.ClassModel;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.ClassModel;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code SourceFile} attribute {@jvms 4.7.10}, which
|
||||
* can appear on classes. Delivered as a {@link jdk.internal.classfile.ClassElement}
|
||||
* can appear on classes. Delivered as a {@link java.lang.classfile.ClassElement}
|
||||
* when traversing a {@link ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface SourceFileAttribute
|
||||
extends Attribute<SourceFileAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundSourceFileAttribute, UnboundAttribute.UnboundSourceFileAttribute {
|
@ -23,25 +23,29 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.ClassModel;
|
||||
import jdk.internal.classfile.constantpool.Utf8Entry;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.ClassModel;
|
||||
import java.lang.classfile.constantpool.Utf8Entry;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code SourceID} attribute, which can
|
||||
* appear on classes. Delivered as a {@link jdk.internal.classfile.ClassElement} when
|
||||
* appear on classes. Delivered as a {@link java.lang.classfile.ClassElement} when
|
||||
* traversing a {@link ClassModel}.
|
||||
* <p>
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface SourceIDAttribute
|
||||
extends Attribute<SourceIDAttribute>, ClassElement
|
||||
permits BoundAttribute.BoundSourceIDAttribute, UnboundAttribute.UnboundSourceIDAttribute {
|
@ -23,20 +23,24 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Label;
|
||||
import jdk.internal.classfile.constantpool.ClassEntry;
|
||||
import java.lang.classfile.Label;
|
||||
import java.lang.classfile.constantpool.ClassEntry;
|
||||
import jdk.internal.classfile.impl.StackMapDecoder;
|
||||
import jdk.internal.classfile.impl.TemporaryConstantPool;
|
||||
import static jdk.internal.classfile.Classfile.*;
|
||||
import static java.lang.classfile.ClassFile.*;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models stack map frame of {@code StackMapTable} attribute {@jvms 4.7.4}.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface StackMapFrameInfo
|
||||
permits StackMapDecoder.StackMapFrameImpl {
|
||||
|
||||
@ -75,7 +79,10 @@ public sealed interface StackMapFrameInfo
|
||||
|
||||
/**
|
||||
* The type of a stack value.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface VerificationTypeInfo {
|
||||
|
||||
/**
|
||||
@ -86,7 +93,10 @@ public sealed interface StackMapFrameInfo
|
||||
|
||||
/**
|
||||
* A simple stack value.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public enum SimpleVerificationTypeInfo implements VerificationTypeInfo {
|
||||
|
||||
/** verification type top */
|
||||
@ -125,7 +135,10 @@ public sealed interface StackMapFrameInfo
|
||||
|
||||
/**
|
||||
* A stack value for an object type.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface ObjectVerificationTypeInfo extends VerificationTypeInfo
|
||||
permits StackMapDecoder.ObjectVerificationTypeInfoImpl {
|
||||
|
||||
@ -140,6 +153,7 @@ public sealed interface StackMapFrameInfo
|
||||
/**
|
||||
* {@return a new object verification type info}
|
||||
* @param classDesc the class of the object
|
||||
* @throws IllegalArgumentException if {@code classDesc} represents a primitive type
|
||||
*/
|
||||
public static ObjectVerificationTypeInfo of(ClassDesc classDesc) {
|
||||
return of(TemporaryConstantPool.INSTANCE.classEntry(classDesc));
|
||||
@ -160,7 +174,10 @@ public sealed interface StackMapFrameInfo
|
||||
|
||||
/**
|
||||
* An uninitialized stack value.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
sealed interface UninitializedVerificationTypeInfo extends VerificationTypeInfo
|
||||
permits StackMapDecoder.UninitializedVerificationTypeInfoImpl {
|
||||
|
@ -23,14 +23,15 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.CodeElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.CodeElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code StackMapTable} attribute {@jvms 4.7.4}, which can appear
|
||||
@ -39,7 +40,12 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* The attribute does not permit multiple instances in a given location.
|
||||
* Subsequent occurrence of the attribute takes precedence during the attributed
|
||||
* element build or transformation.
|
||||
* <p>
|
||||
* The attribute was introduced in the Java SE Platform version 6.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface StackMapTableAttribute
|
||||
extends Attribute<StackMapTableAttribute>, CodeElement
|
||||
permits BoundAttribute.BoundStackMapTableAttribute, UnboundAttribute.UnboundStackMapTableAttribute {
|
@ -23,14 +23,15 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.internal.classfile.attribute;
|
||||
package java.lang.classfile.attribute;
|
||||
|
||||
import jdk.internal.classfile.Attribute;
|
||||
import jdk.internal.classfile.ClassElement;
|
||||
import jdk.internal.classfile.FieldElement;
|
||||
import jdk.internal.classfile.MethodElement;
|
||||
import java.lang.classfile.Attribute;
|
||||
import java.lang.classfile.ClassElement;
|
||||
import java.lang.classfile.FieldElement;
|
||||
import java.lang.classfile.MethodElement;
|
||||
import jdk.internal.classfile.impl.BoundAttribute;
|
||||
import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Models the {@code Synthetic} attribute {@jvms 4.7.8}, which can appear on
|
||||
@ -39,7 +40,10 @@ import jdk.internal.classfile.impl.UnboundAttribute;
|
||||
* of a corresponding model.
|
||||
* <p>
|
||||
* The attribute permits multiple instances in a given location.
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
public sealed interface SyntheticAttribute
|
||||
extends Attribute<SyntheticAttribute>,
|
||||
ClassElement, MethodElement, FieldElement
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user