Class InitializationFinder

java.lang.Object
proguard.evaluation.InitializationFinder
All Implemented Interfaces:
AttributeVisitor, InstructionVisitor

public class InitializationFinder extends Object implements AttributeVisitor, InstructionVisitor
This AttributeVisitor links 'new' instructions and their corresponding initializers in the CodeAttribute instances that it visits.
  • Field Details

  • Constructor Details

    • 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 Details

    • 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, or NONE 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 interface AttributeVisitor
    • visitCodeAttribute

      public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
      Specified by:
      visitCodeAttribute in interface AttributeVisitor