Package proguard.classfile.util
Class DynamicClassReferenceInitializer
- java.lang.Object
-
- proguard.classfile.util.DynamicClassReferenceInitializer
-
- All Implemented Interfaces:
AttributeVisitor
,ConstantVisitor
,InstructionVisitor
,ClassVisitor
public class DynamicClassReferenceInitializer extends java.lang.Object implements ClassVisitor, InstructionVisitor, ConstantVisitor, AttributeVisitor
ThisInstructionVisitor
initializes any constantClass.forName
or.class
references of all classes it visits. More specifically, it fills out the references of string constant pool entries that refer to a class in the program class pool or in the library class pool.It optionally prints notes if on usage of
(SomeClass)Class.forName(variable).newInstance()
.The class hierarchy must be initialized before using this visitor.
It's more efficient to use as a
ClassVisitor
than anInstructionVisitor
.- See Also:
ClassSuperHierarchyInitializer
-
-
Constructor Summary
Constructors Constructor Description DynamicClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter missingNotePrinter, WarningPrinter dependencyWarningPrinter, WarningPrinter notePrinter, StringMatcher noteExceptionMatcher)
Creates a new DynamicClassReferenceInitializer that optionally prints warnings and notes, with optional class specifications for which never to print notes.DynamicClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter missingNotePrinter, WarningPrinter dependencyWarningPrinter, WarningPrinter notePrinter, StringMatcher noteExceptionMatcher, ClassVisitor extraClassVisitor)
Creates a new DynamicClassReferenceInitializer that optionally prints warnings and notes, with optional class specifications for which never to print notes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
visitAnyAttribute(Clazz clazz, Attribute attribute)
Visits any Attribute instance.void
visitAnyClass(Clazz clazz)
Visits any Clazz instance.void
visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
Visits any Instruction instance.void
visitClassConstant(Clazz clazz, ClassConstant classConstant)
Prints out a note about the class cast to this class, if applicable.void
visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
void
visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
Checks whether the referenced method is a .class method.void
visitProgramClass(ProgramClass programClass)
void
visitStringConstant(Clazz clazz, StringConstant stringConstant)
Fills out the link to the referenced class.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface 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
-
Methods inherited from interface proguard.classfile.visitor.ClassVisitor
visitLibraryClass
-
Methods inherited from interface proguard.classfile.constant.visitor.ConstantVisitor
visitAnyConstant, visitAnyMethodrefConstant, visitAnyRefConstant, visitDoubleConstant, visitDynamicConstant, visitFieldrefConstant, visitFloatConstant, visitIntegerConstant, visitInterfaceMethodrefConstant, visitInvokeDynamicConstant, visitLongConstant, visitMethodHandleConstant, visitMethodTypeConstant, visitModuleConstant, visitNameAndTypeConstant, visitPackageConstant, visitPrimitiveArrayConstant, visitUtf8Constant
-
Methods inherited from interface proguard.classfile.instruction.visitor.InstructionVisitor
visitAnySwitchInstruction, visitBranchInstruction, visitConstantInstruction, visitLookUpSwitchInstruction, visitSimpleInstruction, visitTableSwitchInstruction, visitVariableInstruction
-
-
-
-
Field Detail
-
X
public static final int X
- See Also:
- Constant Field Values
-
Y
public static final int Y
- See Also:
- Constant Field Values
-
Z
public static final int Z
- See Also:
- Constant Field Values
-
A
public static final int A
- See Also:
- Constant Field Values
-
B
public static final int B
- See Also:
- Constant Field Values
-
C
public static final int C
- See Also:
- Constant Field Values
-
D
public static final int D
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DynamicClassReferenceInitializer
public DynamicClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter missingNotePrinter, WarningPrinter dependencyWarningPrinter, WarningPrinter notePrinter, StringMatcher noteExceptionMatcher)
Creates a new DynamicClassReferenceInitializer that optionally prints warnings and notes, with optional class specifications for which never to print notes.
-
DynamicClassReferenceInitializer
public DynamicClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter missingNotePrinter, WarningPrinter dependencyWarningPrinter, WarningPrinter notePrinter, StringMatcher noteExceptionMatcher, ClassVisitor extraClassVisitor)
Creates a new DynamicClassReferenceInitializer that optionally prints warnings and notes, with optional class specifications for which never to print notes.
-
-
Method Detail
-
visitAnyClass
public void visitAnyClass(Clazz clazz)
Description copied from interface:ClassVisitor
Visits any Clazz instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyClass
in interfaceClassVisitor
-
visitProgramClass
public void visitProgramClass(ProgramClass programClass)
- Specified by:
visitProgramClass
in interfaceClassVisitor
-
visitAnyInstruction
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
Description copied from interface:InstructionVisitor
Visits any Instruction instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyInstruction
in interfaceInstructionVisitor
-
visitStringConstant
public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
Fills out the link to the referenced class.- Specified by:
visitStringConstant
in interfaceConstantVisitor
-
visitClassConstant
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
Prints out a note about the class cast to this class, if applicable.- Specified by:
visitClassConstant
in interfaceConstantVisitor
-
visitMethodrefConstant
public void visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
Checks whether the referenced method is a .class method.- Specified by:
visitMethodrefConstant
in interfaceConstantVisitor
-
visitAnyAttribute
public void visitAnyAttribute(Clazz clazz, Attribute attribute)
Description copied from interface:AttributeVisitor
Visits any Attribute instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyAttribute
in interfaceAttributeVisitor
-
visitCodeAttribute
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- Specified by:
visitCodeAttribute
in interfaceAttributeVisitor
-
-