Package proguard.classfile.util
Class ClassReferenceInitializer
- java.lang.Object
-
- proguard.classfile.util.ClassReferenceInitializer
-
- All Implemented Interfaces:
AnnotationVisitor
,ElementValueVisitor
,AttributeVisitor
,LocalVariableInfoVisitor
,LocalVariableTypeInfoVisitor
,RecordComponentInfoVisitor
,ConstantVisitor
,ClassVisitor
,MemberVisitor
public class ClassReferenceInitializer extends java.lang.Object implements ClassVisitor, MemberVisitor, ConstantVisitor, AttributeVisitor, RecordComponentInfoVisitor, LocalVariableInfoVisitor, LocalVariableTypeInfoVisitor, AnnotationVisitor, ElementValueVisitor
ThisClassVisitor
initializes the references of all classes that it visits.All class constant pool entries get direct references to the corresponding classes. These references make it more convenient to travel up and across the class hierarchy.
All field and method reference constant pool entries get direct references to the corresponding classes, fields, and methods.
All name and type constant pool entries get a list of direct references to the classes listed in the type.
The classpools are searched by keys and not by Clazz.getName(), so after obfuscation make sure to pass a ClassPool.refreshedCopy() to this class.
All Kotlin metadata elements get references to their corresponding Java implementation elements.
The class hierarchy must be initialized before using this visitor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClassReferenceInitializer.KotlinTypeAliasReferenceInitializer
-
Constructor Summary
Constructors Constructor Description ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files.ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, boolean checkAccessRules)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files.ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, boolean checkAccessRules, InvalidReferenceVisitor invalidReferenceVisitor)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files, visiting the givenInvalidReferenceVisitor
for any broken references.ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, boolean checkAccessRules, WarningPrinter missingClassWarningPrinter, WarningPrinter missingProgramMemberWarningPrinter, WarningPrinter missingLibraryMemberWarningPrinter, WarningPrinter dependencyWarningPrinter)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files, optionally printing warnings if some classes or class members can't be found or if they are in the program class pool.ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter missingClassWarningPrinter, WarningPrinter missingProgramMemberWarningPrinter, WarningPrinter missingLibraryMemberWarningPrinter, WarningPrinter dependencyWarningPrinter)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files, optionally printing warnings if some classes or class members can't be found or if they are in the program class pool.
-
Method Summary
-
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.annotation.visitor.AnnotationVisitor
visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation
-
Methods inherited from interface proguard.classfile.attribute.visitor.AttributeVisitor
visitAnyTypeAnnotationsAttribute, visitBootstrapMethodsAttribute, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitExceptionsAttribute, visitInnerClassesAttribute, visitLineNumberTableAttribute, visitMethodParametersAttribute, visitModuleAttribute, visitModuleMainClassAttribute, visitModulePackagesAttribute, visitNestHostAttribute, visitNestMembersAttribute, visitPermittedSubclassesAttribute, 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, visitSourceDebugExtensionAttribute, visitSourceDirAttribute, visitSourceFileAttribute, visitStackMapAttribute, visitStackMapTableAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitUnknownAttribute
-
Methods inherited from interface proguard.classfile.constant.visitor.ConstantVisitor
visitAnyRefConstant, visitDoubleConstant, visitFloatConstant, visitIntegerConstant, visitInterfaceMethodrefConstant, visitLongConstant, visitMethodrefConstant, visitModuleConstant, visitNameAndTypeConstant, visitPackageConstant, visitPrimitiveArrayConstant, visitUtf8Constant
-
Methods inherited from interface proguard.classfile.attribute.annotation.visitor.ElementValueVisitor
visitAnyElementValue
-
Methods inherited from interface proguard.classfile.visitor.MemberVisitor
visitAnyMember, visitLibraryMember, visitProgramMember
-
-
-
-
Constructor Detail
-
ClassReferenceInitializer
public ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files.
-
ClassReferenceInitializer
public ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, boolean checkAccessRules)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files.
-
ClassReferenceInitializer
public ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter missingClassWarningPrinter, WarningPrinter missingProgramMemberWarningPrinter, WarningPrinter missingLibraryMemberWarningPrinter, WarningPrinter dependencyWarningPrinter)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files, optionally printing warnings if some classes or class members can't be found or if they are in the program class pool.
-
ClassReferenceInitializer
public ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, boolean checkAccessRules, WarningPrinter missingClassWarningPrinter, WarningPrinter missingProgramMemberWarningPrinter, WarningPrinter missingLibraryMemberWarningPrinter, WarningPrinter dependencyWarningPrinter)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files, optionally printing warnings if some classes or class members can't be found or if they are in the program class pool.
-
ClassReferenceInitializer
public ClassReferenceInitializer(ClassPool programClassPool, ClassPool libraryClassPool, boolean checkAccessRules, InvalidReferenceVisitor invalidReferenceVisitor)
Creates a new ClassReferenceInitializer that initializes the references of all visited class files, visiting the givenInvalidReferenceVisitor
for any broken references.
-
-
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
-
visitLibraryClass
public void visitLibraryClass(LibraryClass libraryClass)
- Specified by:
visitLibraryClass
in interfaceClassVisitor
-
visitProgramField
public void visitProgramField(ProgramClass programClass, ProgramField programField)
- Specified by:
visitProgramField
in interfaceMemberVisitor
-
visitProgramMethod
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- Specified by:
visitProgramMethod
in interfaceMemberVisitor
-
visitLibraryField
public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- Specified by:
visitLibraryField
in interfaceMemberVisitor
-
visitLibraryMethod
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- Specified by:
visitLibraryMethod
in interfaceMemberVisitor
-
visitAnyConstant
public void visitAnyConstant(Clazz clazz, Constant constant)
Description copied from interface:ConstantVisitor
Visits any Constant instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyConstant
in interfaceConstantVisitor
-
visitStringConstant
public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
- Specified by:
visitStringConstant
in interfaceConstantVisitor
-
visitDynamicConstant
public void visitDynamicConstant(Clazz clazz, DynamicConstant dynamicConstant)
- Specified by:
visitDynamicConstant
in interfaceConstantVisitor
-
visitInvokeDynamicConstant
public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
- Specified by:
visitInvokeDynamicConstant
in interfaceConstantVisitor
-
visitMethodHandleConstant
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant)
- Specified by:
visitMethodHandleConstant
in interfaceConstantVisitor
-
visitFieldrefConstant
public void visitFieldrefConstant(Clazz clazz, FieldrefConstant fieldrefConstant)
- Specified by:
visitFieldrefConstant
in interfaceConstantVisitor
-
visitAnyMethodrefConstant
public void visitAnyMethodrefConstant(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant)
Description copied from interface:ConstantVisitor
Visits any RefConstant instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyMethodrefConstant
in interfaceConstantVisitor
-
visitClassConstant
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
- Specified by:
visitClassConstant
in interfaceConstantVisitor
-
visitMethodTypeConstant
public void visitMethodTypeConstant(Clazz clazz, MethodTypeConstant methodTypeConstant)
- Specified by:
visitMethodTypeConstant
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
-
visitRecordAttribute
public void visitRecordAttribute(Clazz clazz, RecordAttribute recordAttributeAttribute)
- Specified by:
visitRecordAttribute
in interfaceAttributeVisitor
-
visitEnclosingMethodAttribute
public void visitEnclosingMethodAttribute(Clazz clazz, EnclosingMethodAttribute enclosingMethodAttribute)
- Specified by:
visitEnclosingMethodAttribute
in interfaceAttributeVisitor
-
visitCodeAttribute
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- Specified by:
visitCodeAttribute
in interfaceAttributeVisitor
-
visitLocalVariableTableAttribute
public void visitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)
- Specified by:
visitLocalVariableTableAttribute
in interfaceAttributeVisitor
-
visitLocalVariableTypeTableAttribute
public void visitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)
- Specified by:
visitLocalVariableTypeTableAttribute
in interfaceAttributeVisitor
-
visitSignatureAttribute
public void visitSignatureAttribute(Clazz clazz, Member member, SignatureAttribute signatureAttribute)
- Specified by:
visitSignatureAttribute
in interfaceAttributeVisitor
-
visitSignatureAttribute
public void visitSignatureAttribute(Clazz clazz, RecordComponentInfo recordComponentInfo, SignatureAttribute signatureAttribute)
- Specified by:
visitSignatureAttribute
in interfaceAttributeVisitor
-
visitSignatureAttribute
public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute)
- Specified by:
visitSignatureAttribute
in interfaceAttributeVisitor
-
visitAnyAnnotationsAttribute
public void visitAnyAnnotationsAttribute(Clazz clazz, AnnotationsAttribute annotationsAttribute)
Description copied from interface:AttributeVisitor
Visits any AnnotationsAttribute instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyAnnotationsAttribute
in interfaceAttributeVisitor
-
visitAnyParameterAnnotationsAttribute
public void visitAnyParameterAnnotationsAttribute(Clazz clazz, Method method, ParameterAnnotationsAttribute parameterAnnotationsAttribute)
Description copied from interface:AttributeVisitor
Visits any ParameterAnnotationsAttribute instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyParameterAnnotationsAttribute
in interfaceAttributeVisitor
-
visitAnnotationDefaultAttribute
public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
- Specified by:
visitAnnotationDefaultAttribute
in interfaceAttributeVisitor
-
visitRecordComponentInfo
public void visitRecordComponentInfo(Clazz clazz, RecordComponentInfo recordComponentInfo)
- Specified by:
visitRecordComponentInfo
in interfaceRecordComponentInfoVisitor
-
visitLocalVariableInfo
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
- Specified by:
visitLocalVariableInfo
in interfaceLocalVariableInfoVisitor
-
visitLocalVariableTypeInfo
public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
- Specified by:
visitLocalVariableTypeInfo
in interfaceLocalVariableTypeInfoVisitor
-
visitAnnotation
public void visitAnnotation(Clazz clazz, Annotation annotation)
Description copied from interface:AnnotationVisitor
Visits any Annotation instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnnotation
in interfaceAnnotationVisitor
-
visitConstantElementValue
public void visitConstantElementValue(Clazz clazz, Annotation annotation, ConstantElementValue constantElementValue)
- Specified by:
visitConstantElementValue
in interfaceElementValueVisitor
-
visitEnumConstantElementValue
public void visitEnumConstantElementValue(Clazz clazz, Annotation annotation, EnumConstantElementValue enumConstantElementValue)
- Specified by:
visitEnumConstantElementValue
in interfaceElementValueVisitor
-
visitClassElementValue
public void visitClassElementValue(Clazz clazz, Annotation annotation, ClassElementValue classElementValue)
- Specified by:
visitClassElementValue
in interfaceElementValueVisitor
-
visitAnnotationElementValue
public void visitAnnotationElementValue(Clazz clazz, Annotation annotation, AnnotationElementValue annotationElementValue)
- Specified by:
visitAnnotationElementValue
in interfaceElementValueVisitor
-
visitArrayElementValue
public void visitArrayElementValue(Clazz clazz, Annotation annotation, ArrayElementValue arrayElementValue)
- Specified by:
visitArrayElementValue
in interfaceElementValueVisitor
-
-