Package proguard.evaluation
Class InitializationFinder
- java.lang.Object
-
- proguard.evaluation.InitializationFinder
-
- All Implemented Interfaces:
AttributeVisitor
,InstructionVisitor
public class InitializationFinder extends java.lang.Object implements AttributeVisitor, InstructionVisitor
ThisAttributeVisitor
links 'new' instructions and their corresponding initializers in theCodeAttribute
instances that it visits.
-
-
Field Summary
Fields Modifier and Type Field Description static int
NONE
-
Constructor Summary
Constructors Constructor Description InitializationFinder()
Creates a new InitializationFinder.InitializationFinder(PartialEvaluator partialEvaluator, boolean runPartialEvaluator)
Creates a new InitializationFinder that will use the given partial evaluator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
creationOffset(int initializationOffset)
Returns the 'new' instruction offset at which the object instance is created that is initialized at the given offset.boolean
isInitializedBefore(int offset, int stackEntryIndexBottom)
Returns whether the specified stack entry is initialized.boolean
isInitializedBefore(int offset, InstructionOffsetValue creationOffsetValue)
Returns whether the given creation offset is initialized before the given offset.boolean
isInitializer()
Returns whether the method is an instance initializer, in the CodeAttribute that was visited most recently.boolean
isInitializer(int offset)
Returns whether the instruction at the given offset is the special invocation of an instance initializer.boolean
isTopInitializedBefore(int offset, int stackEntryIndexTop)
Returns whether the specified stack entry is initialized.int
superInitializationOffset()
Returns the instruction offset at which this initializer is calling the "super" or "this" initializer method, orNONE
if it is not an initializer.void
visitAnyAttribute(Clazz clazz, Attribute attribute)
Visits any Attribute instance.void
visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
-
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.instruction.visitor.InstructionVisitor
visitAnyInstruction, visitAnySwitchInstruction, visitBranchInstruction, visitConstantInstruction, visitLookUpSwitchInstruction, visitSimpleInstruction, visitTableSwitchInstruction, visitVariableInstruction
-
-
-
-
Field Detail
-
NONE
public static final int NONE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InitializationFinder
public InitializationFinder()
Creates a new InitializationFinder.
-
InitializationFinder
public InitializationFinder(PartialEvaluator partialEvaluator, boolean runPartialEvaluator)
Creates a new InitializationFinder that will use the given partial evaluator.- Parameters:
partialEvaluator
- the evaluator to be used for the analysis.runPartialEvaluator
- specifies whether to run this evaluator on every code attribute that is visited.
-
-
Method Detail
-
isInitializer
public boolean isInitializer()
Returns whether the method is an instance initializer, in the CodeAttribute that was visited most recently.
-
superInitializationOffset
public int superInitializationOffset()
Returns the instruction offset at which this initializer is calling the "super" or "this" initializer method, orNONE
if it is not an initializer.
-
creationOffset
public int creationOffset(int initializationOffset)
Returns the 'new' instruction offset at which the object instance is created that is initialized at the given offset.
-
isInitializedBefore
public boolean isInitializedBefore(int offset, int stackEntryIndexBottom)
Returns whether the specified stack entry is initialized.
-
isTopInitializedBefore
public boolean isTopInitializedBefore(int offset, int stackEntryIndexTop)
Returns whether the specified stack entry is initialized.
-
isInitializedBefore
public boolean isInitializedBefore(int offset, InstructionOffsetValue creationOffsetValue)
Returns whether the given creation offset is initialized before the given offset.
-
isInitializer
public boolean isInitializer(int offset)
Returns whether the instruction at the given offset is the special invocation of an instance initializer.
-
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
-
-