Package proguard.classfile.editor
Class ConstantAdder
java.lang.Object
proguard.classfile.editor.ConstantAdder
- All Implemented Interfaces:
ConstantVisitor
This
ConstantVisitor adds all constants that it visits to the constant pool of a given
target class.
Bootstrap methods attributes are automatically updated for invokedynamic constants.
-
Constructor Summary
ConstructorsConstructorDescriptionConstantAdder(ProgramClass targetClass) Creates a new ConstantAdder that will copy constants into the given target class. -
Method Summary
Modifier and TypeMethodDescriptionintaddConstant(Clazz clazz, int constantIndex) Adds a copy of the specified constant in the given class and returns its index.intaddConstant(Clazz clazz, Constant constant) Adds a copy of the given constant in the given class and returns its index.intReturns the index of the most recently created constant in the constant pool of the target class.voidvisitClassConstant(Clazz clazz, ClassConstant classConstant) voidvisitDoubleConstant(Clazz clazz, DoubleConstant doubleConstant) voidvisitDynamicConstant(Clazz clazz, DynamicConstant dynamicConstant) voidvisitFieldrefConstant(Clazz clazz, FieldrefConstant fieldrefConstant) voidvisitFloatConstant(Clazz clazz, FloatConstant floatConstant) voidvisitIntegerConstant(Clazz clazz, IntegerConstant integerConstant) voidvisitInterfaceMethodrefConstant(Clazz clazz, InterfaceMethodrefConstant interfaceMethodrefConstant) voidvisitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant) voidvisitLongConstant(Clazz clazz, LongConstant longConstant) voidvisitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) voidvisitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant) voidvisitMethodTypeConstant(Clazz clazz, MethodTypeConstant methodTypeConstant) voidvisitModuleConstant(Clazz clazz, ModuleConstant moduleConstant) voidvisitNameAndTypeConstant(Clazz clazz, NameAndTypeConstant nameAndTypeConstant) voidvisitPackageConstant(Clazz clazz, PackageConstant packageConstant) voidvisitPrimitiveArrayConstant(Clazz clazz, PrimitiveArrayConstant primitiveArrayConstant) voidvisitStringConstant(Clazz clazz, StringConstant stringConstant) voidvisitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface proguard.classfile.constant.visitor.ConstantVisitor
visitAnyConstant, visitAnyMethodrefConstant, visitAnyRefConstant
-
Constructor Details
-
ConstantAdder
Creates a new ConstantAdder that will copy constants into the given target class.
-
-
Method Details
-
addConstant
Adds a copy of the specified constant in the given class and returns its index. If the specified index is 0, the returned value is 0 too. -
addConstant
Adds a copy of the given constant in the given class and returns its index. -
getConstantIndex
public int getConstantIndex()Returns the index of the most recently created constant in the constant pool of the target class. -
visitIntegerConstant
- Specified by:
visitIntegerConstantin interfaceConstantVisitor
-
visitLongConstant
- Specified by:
visitLongConstantin interfaceConstantVisitor
-
visitFloatConstant
- Specified by:
visitFloatConstantin interfaceConstantVisitor
-
visitDoubleConstant
- Specified by:
visitDoubleConstantin interfaceConstantVisitor
-
visitPrimitiveArrayConstant
- Specified by:
visitPrimitiveArrayConstantin interfaceConstantVisitor
-
visitStringConstant
- Specified by:
visitStringConstantin interfaceConstantVisitor
-
visitUtf8Constant
- Specified by:
visitUtf8Constantin interfaceConstantVisitor
-
visitDynamicConstant
- Specified by:
visitDynamicConstantin interfaceConstantVisitor
-
visitInvokeDynamicConstant
- Specified by:
visitInvokeDynamicConstantin interfaceConstantVisitor
-
visitMethodHandleConstant
- Specified by:
visitMethodHandleConstantin interfaceConstantVisitor
-
visitModuleConstant
- Specified by:
visitModuleConstantin interfaceConstantVisitor
-
visitPackageConstant
- Specified by:
visitPackageConstantin interfaceConstantVisitor
-
visitFieldrefConstant
- Specified by:
visitFieldrefConstantin interfaceConstantVisitor
-
visitInterfaceMethodrefConstant
public void visitInterfaceMethodrefConstant(Clazz clazz, InterfaceMethodrefConstant interfaceMethodrefConstant) - Specified by:
visitInterfaceMethodrefConstantin interfaceConstantVisitor
-
visitMethodrefConstant
- Specified by:
visitMethodrefConstantin interfaceConstantVisitor
-
visitClassConstant
- Specified by:
visitClassConstantin interfaceConstantVisitor
-
visitMethodTypeConstant
- Specified by:
visitMethodTypeConstantin interfaceConstantVisitor
-
visitNameAndTypeConstant
- Specified by:
visitNameAndTypeConstantin interfaceConstantVisitor
-