类 InitializerEditor
java.lang.Object
proguard.classfile.editor.InitializerEditor
- 所有已实现的接口:
AttributeVisitor
This editor allows to build and/or edit classes (ProgramClass instances). It provides methods to
easily add fields and methods to classes.
-
嵌套类概要
嵌套类修饰符和类型类说明static interfaceThis functional interface provides an instruction sequence builder to its caller. -
构造器概要
构造器构造器说明InitializerEditor(ProgramClass programClass) Creates a new InitializerEditor for the given class.InitializerEditor(ProgramClass programClass, CodeAttributeEditor codeAttributeEditor) Creates a new InitializerEditor for the given class. -
方法概要
修饰符和类型方法说明voidaddInitializerInstructions(InitializerEditor.CodeBuilder codeBuilder) Adds the specified initialization instructions to the edited class.voidaddInitializerInstructions(Instruction[] instructions) Adds the given initialization instructions to the edited class.addStaticInitializerInstructions(boolean mergeIntoExistingInitializer, InitializerEditor.CodeBuilder codeBuilder) Adds the specified static initializer instructions to the edited class.addStaticInitializerInstructions(boolean mergeIntoExistingInitializer, Instruction[] instructions) Adds the given static initializer instructions to the edited class.voidvisitAnyAttribute(Clazz clazz, Attribute attribute) Visits any Attribute instance.voidvisitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 proguard.classfile.attribute.visitor.AttributeVisitor
visitAnnotationDefaultAttribute, visitAnyAnnotationsAttribute, visitAnyParameterAnnotationsAttribute, visitAnyTypeAnnotationsAttribute, visitBootstrapMethodsAttribute, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitEnclosingMethodAttribute, visitExceptionsAttribute, visitInnerClassesAttribute, visitLineNumberTableAttribute, visitLocalVariableTableAttribute, visitLocalVariableTypeTableAttribute, visitMethodParametersAttribute, visitModuleAttribute, visitModuleMainClassAttribute, visitModulePackagesAttribute, visitNestHostAttribute, visitNestMembersAttribute, visitPermittedSubclassesAttribute, visitRecordAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleParameterAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleParameterAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSourceDebugExtensionAttribute, visitSourceDirAttribute, visitSourceFileAttribute, visitStackMapAttribute, visitStackMapTableAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitUnknownAttribute
-
构造器详细资料
-
InitializerEditor
Creates a new InitializerEditor for the given class.- 参数:
programClass- The class to be edited.
-
InitializerEditor
Creates a new InitializerEditor for the given class.- 参数:
programClass- The class to be edited.codeAttributeEditor- The CodeAttributeEditor to use for code editing.
-
-
方法详细资料
-
addStaticInitializerInstructions
public Method addStaticInitializerInstructions(boolean mergeIntoExistingInitializer, InitializerEditor.CodeBuilder codeBuilder) Adds the specified static initializer instructions to the edited class. If the class already contains a static initializer, the new instructions will be inserted at the start of the existing initializer.- 参数:
mergeIntoExistingInitializer- Indicates whether the instructions should be added to the existing static initializer (if it exists), or if a new method should be created, which is then called from the existing initializer.codeBuilder- The provider of a builder to add instructions. This functional interface can conveniently be implemented as a closure.- 返回:
- The created or modified static initializer.
-
addStaticInitializerInstructions
public Method addStaticInitializerInstructions(boolean mergeIntoExistingInitializer, Instruction[] instructions) Adds the given static initializer instructions to the edited class. If the class already contains a static initializer, the new instructions will be inserted at the start of the existing initializer.- 参数:
mergeIntoExistingInitializer- Indicates whether the instructions should be added to the existing static initializer (if it exists), or if a new method should be created, which is then called from the existing initializer.instructions- The instructions to be added.- 返回:
- The created or modified static initializer.
-
addInitializerInstructions
Adds the specified initialization instructions to the edited class.- If the class doesn't contain a constructor yet, it will be created, and the instructions will be added to this constructor.
- If there is a single super-calling constructor, the instructions will be added at the beginning of its code attribute.
- If there are multiple super-calling constructors, a new private parameterless helper method will be created, to which the instructions will be added. An invocation to this new method will be added at the beginning of the code attribute of all super-calling constructors.
- 参数:
codeBuilder- The provider of a builder to add instructions. This functional interface can conveniently be implemented as a closure.
-
addInitializerInstructions
Adds the given initialization instructions to the edited class.- If the class doesn't contain a constructor yet, it will be created, and the instructions will be added to this constructor.
- If there is a single super-calling constructor, the instructions will be added at the beginning of its code attribute.
- If there are multiple super-calling constructors, a new private parameterless helper method will be created, to which the instructions will be added. An invocation to this new method will be added at the beginning of the code attribute of all super-calling constructors.
- 参数:
instructions- The instructions to be added.
-
visitAnyAttribute
从接口复制的说明:AttributeVisitorVisits any Attribute instance. The more specific default implementations of this interface delegate to this method.- 指定者:
visitAnyAttribute在接口中AttributeVisitor
-
visitCodeAttribute
- 指定者:
visitCodeAttribute在接口中AttributeVisitor
-