java.lang.Object
java.lang.Record
org.glavo.classfile.impl.ClassFileImpl
- All Implemented Interfaces:
ClassFile
public record ClassFileImpl(ClassFile.StackMapsOption stackMapsOption, ClassFile.DebugElementsOption debugElementsOption, ClassFile.LineNumbersOption lineNumbersOption, ClassFile.AttributesProcessingOption attributesProcessingOption, ClassFile.ConstantPoolSharingOption constantPoolSharingOption, ClassFile.ShortJumpsOption shortJumpsOption, ClassFile.DeadCodeOption deadCodeOption, ClassFile.DeadLabelsOption deadLabelsOption, ClassFile.ClassHierarchyResolverOption classHierarchyResolverOption, ClassFile.AttributeMapperOption attributeMapperOption)
extends Record
implements ClassFile
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordNested classes/interfaces inherited from interface org.glavo.classfile.ClassFile
ClassFile.AttributeMapperOption, ClassFile.AttributesProcessingOption, ClassFile.ClassHierarchyResolverOption, ClassFile.ConstantPoolSharingOption, ClassFile.DeadCodeOption, ClassFile.DeadLabelsOption, ClassFile.DebugElementsOption, ClassFile.LineNumbersOption, ClassFile.Option, ClassFile.ShortJumpsOption, ClassFile.StackMapsOption -
Field Summary
FieldsFields inherited from interface org.glavo.classfile.ClassFile
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_MODULE, ACC_NATIVE, ACC_OPEN, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STATIC_PHASE, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_TRANSITIVE, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, AEV_ANNOTATION, AEV_ARRAY, AEV_BOOLEAN, AEV_BYTE, AEV_CHAR, AEV_CLASS, AEV_DOUBLE, AEV_ENUM, AEV_FLOAT, AEV_INT, AEV_LONG, AEV_SHORT, AEV_STRING, ALOAD, ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, CRT_ASSIGNMENT, CRT_BLOCK, CRT_BRANCH_FALSE, CRT_BRANCH_TRUE, CRT_CREATE, CRT_FLOW_CONTROLLER, CRT_FLOW_TARGET, CRT_INVOKE, CRT_STATEMENT, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DEFAULT_CLASS_FLAGS, DLOAD, DLOAD_0, DLOAD_1, DLOAD_2, DLOAD_3, DMUL, DNEG, DREM, DRETURN, DSTORE, DSTORE_0, DSTORE_1, DSTORE_2, DSTORE_3, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAD_0, FLOAD_1, FLOAD_2, FLOAD_3, FMUL, FNEG, FREM, FRETURN, FSTORE, FSTORE_0, FSTORE_1, FSTORE_2, FSTORE_3, FSUB, GETFIELD, GETSTATIC, GOTO, GOTO_W, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, IMUL, INEG, INSTANCEOF, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, ISUB, IUSHR, IXOR, JAVA_1_VERSION, JAVA_10_VERSION, JAVA_11_VERSION, JAVA_12_VERSION, JAVA_13_VERSION, JAVA_14_VERSION, JAVA_15_VERSION, JAVA_16_VERSION, JAVA_17_VERSION, JAVA_18_VERSION, JAVA_19_VERSION, JAVA_2_VERSION, JAVA_20_VERSION, JAVA_21_VERSION, JAVA_22_VERSION, JAVA_23_VERSION, JAVA_3_VERSION, JAVA_4_VERSION, JAVA_5_VERSION, JAVA_6_VERSION, JAVA_7_VERSION, JAVA_8_VERSION, JAVA_9_VERSION, JSR, JSR_W, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDC_W, LDC2_W, LDIV, LLOAD, LLOAD_0, LLOAD_1, LLOAD_2, LLOAD_3, LMUL, LNEG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSTORE_0, LSTORE_1, LSTORE_2, LSTORE_3, LSUB, LUSHR, LXOR, MAGIC_NUMBER, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, POP, POP2, PREVIEW_MINOR_VERSION, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, TABLESWITCH, TAG_CLASS, TAG_CONSTANTDYNAMIC, TAG_DOUBLE, TAG_FIELDREF, TAG_FLOAT, TAG_INTEGER, TAG_INTERFACEMETHODREF, TAG_INVOKEDYNAMIC, TAG_LONG, TAG_METHODHANDLE, TAG_METHODREF, TAG_METHODTYPE, TAG_MODULE, TAG_NAMEANDTYPE, TAG_PACKAGE, TAG_STRING, TAG_UNICODE, TAG_UTF8, TAT_CAST, TAT_CLASS_EXTENDS, TAT_CLASS_TYPE_PARAMETER, TAT_CLASS_TYPE_PARAMETER_BOUND, TAT_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, TAT_CONSTRUCTOR_REFERENCE, TAT_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, TAT_EXCEPTION_PARAMETER, TAT_FIELD, TAT_INSTANCEOF, TAT_LOCAL_VARIABLE, TAT_METHOD_FORMAL_PARAMETER, TAT_METHOD_INVOCATION_TYPE_ARGUMENT, TAT_METHOD_RECEIVER, TAT_METHOD_REFERENCE, TAT_METHOD_REFERENCE_TYPE_ARGUMENT, TAT_METHOD_RETURN, TAT_METHOD_TYPE_PARAMETER, TAT_METHOD_TYPE_PARAMETER_BOUND, TAT_NEW, TAT_RESOURCE_VARIABLE, TAT_THROWS, VT_DOUBLE, VT_FLOAT, VT_INTEGER, VT_LONG, VT_NULL, VT_OBJECT, VT_TOP, VT_UNINITIALIZED, VT_UNINITIALIZED_THIS, WIDE -
Constructor Summary
ConstructorsConstructorDescriptionClassFileImpl(ClassFile.StackMapsOption stackMapsOption, ClassFile.DebugElementsOption debugElementsOption, ClassFile.LineNumbersOption lineNumbersOption, ClassFile.AttributesProcessingOption attributesProcessingOption, ClassFile.ConstantPoolSharingOption constantPoolSharingOption, ClassFile.ShortJumpsOption shortJumpsOption, ClassFile.DeadCodeOption deadCodeOption, ClassFile.DeadLabelsOption deadLabelsOption, ClassFile.ClassHierarchyResolverOption classHierarchyResolverOption, ClassFile.AttributeMapperOption attributeMapperOption) Creates an instance of aClassFileImplrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributeMapperOptionrecord component.Returns the value of theattributesProcessingOptionrecord component.byte[]build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler) Build a classfile into a byte array using the provided constant pool builder.Returns the value of theclassHierarchyResolverOptionrecord component.Returns the value of theconstantPoolSharingOptionrecord component.Returns the value of thedeadCodeOptionrecord component.Returns the value of thedeadLabelsOptionrecord component.Returns the value of thedebugElementsOptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelineNumbersOptionrecord component.parse(byte[] bytes) Parse a classfile into aClassModel.Returns the value of theshortJumpsOptionrecord component.Returns the value of thestackMapsOptionrecord component.final StringtoString()Returns a string representation of this record class.byte[]transform(ClassModel model, ClassEntry newClassName, ClassTransform transform) Transform one classfile into a new classfile with the aid of aClassTransform.verify(byte[] bytes) Verify a classfile.verify(ClassModel model) Verify a classfile.withOptions(ClassFile.Option... options) Returns a copy of the context with altered options.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.glavo.classfile.ClassFile
build, buildModule, buildModule, buildModuleTo, buildModuleTo, buildTo, buildTo, parse, transform, transform, verify
-
Field Details
-
DEFAULT_CONTEXT
-
-
Constructor Details
-
ClassFileImpl
public ClassFileImpl(ClassFile.StackMapsOption stackMapsOption, ClassFile.DebugElementsOption debugElementsOption, ClassFile.LineNumbersOption lineNumbersOption, ClassFile.AttributesProcessingOption attributesProcessingOption, ClassFile.ConstantPoolSharingOption constantPoolSharingOption, ClassFile.ShortJumpsOption shortJumpsOption, ClassFile.DeadCodeOption deadCodeOption, ClassFile.DeadLabelsOption deadLabelsOption, ClassFile.ClassHierarchyResolverOption classHierarchyResolverOption, ClassFile.AttributeMapperOption attributeMapperOption) Creates an instance of aClassFileImplrecord class.- Parameters:
stackMapsOption- the value for thestackMapsOptionrecord componentdebugElementsOption- the value for thedebugElementsOptionrecord componentlineNumbersOption- the value for thelineNumbersOptionrecord componentattributesProcessingOption- the value for theattributesProcessingOptionrecord componentconstantPoolSharingOption- the value for theconstantPoolSharingOptionrecord componentshortJumpsOption- the value for theshortJumpsOptionrecord componentdeadCodeOption- the value for thedeadCodeOptionrecord componentdeadLabelsOption- the value for thedeadLabelsOptionrecord componentclassHierarchyResolverOption- the value for theclassHierarchyResolverOptionrecord componentattributeMapperOption- the value for theattributeMapperOptionrecord component
-
-
Method Details
-
withOptions
Description copied from interface:ClassFileReturns a copy of the context with altered options.- Specified by:
withOptionsin interfaceClassFile- Parameters:
options- the desired processing options- Returns:
- a copy of the context with altered options
-
parse
Description copied from interface:ClassFileParse a classfile into aClassModel. -
build
public byte[] build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler) Description copied from interface:ClassFileBuild a classfile into a byte array using the provided constant pool builder.- Specified by:
buildin interfaceClassFile- Parameters:
thisClassEntry- the name of the class to buildconstantPool- the constant pool builderhandler- a handler that receives aClassBuilder- Returns:
- the classfile bytes
-
transform
Description copied from interface:ClassFileTransform one classfile into a new classfile with the aid of aClassTransform. The transform will receive each element of this class, as well as aClassBuilderfor building the new class. The transform is free to preserve, remove, or replace elements as it sees fit. -
verify
Description copied from interface:ClassFileVerify a classfile. Any verification errors found will be returned. -
verify
Description copied from interface:ClassFileVerify a classfile. Any verification errors found will be returned. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
stackMapsOption
Returns the value of thestackMapsOptionrecord component.- Returns:
- the value of the
stackMapsOptionrecord component
-
debugElementsOption
Returns the value of thedebugElementsOptionrecord component.- Returns:
- the value of the
debugElementsOptionrecord component
-
lineNumbersOption
Returns the value of thelineNumbersOptionrecord component.- Returns:
- the value of the
lineNumbersOptionrecord component
-
attributesProcessingOption
Returns the value of theattributesProcessingOptionrecord component.- Returns:
- the value of the
attributesProcessingOptionrecord component
-
constantPoolSharingOption
Returns the value of theconstantPoolSharingOptionrecord component.- Returns:
- the value of the
constantPoolSharingOptionrecord component
-
shortJumpsOption
Returns the value of theshortJumpsOptionrecord component.- Returns:
- the value of the
shortJumpsOptionrecord component
-
deadCodeOption
Returns the value of thedeadCodeOptionrecord component.- Returns:
- the value of the
deadCodeOptionrecord component
-
deadLabelsOption
Returns the value of thedeadLabelsOptionrecord component.- Returns:
- the value of the
deadLabelsOptionrecord component
-
classHierarchyResolverOption
Returns the value of theclassHierarchyResolverOptionrecord component.- Returns:
- the value of the
classHierarchyResolverOptionrecord component
-
attributeMapperOption
Returns the value of theattributeMapperOptionrecord component.- Returns:
- the value of the
attributeMapperOptionrecord component
-