Class LocalVariables

java.lang.Object
org.apache.bcel.verifier.structurals.LocalVariables
All Implemented Interfaces:
Cloneable

public class LocalVariables extends Object implements Cloneable
This class implements an array of local variables used for symbolic JVM simulation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LocalVariables(int localVariableCount)
    Creates a new LocalVariables object.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a deep copy of this object; i.e.
    boolean
     
    get(int slotIndex)
    Returns the type of the local variable slot index.
    Returns a (correctly typed) clone of this object.
    int
     
    void
    initializeObject(UninitializedObjectType uninitializedObjectType)
    Replaces all occurrences of uninitializedObjectType in this local variables set with an "initialized" ObjectType.
    int
    Returns the number of local variable slots.
    void
    merge(LocalVariables localVariable)
    Merges two local variables sets as described in the Java Virtual Machine Specification, Second Edition, section 4.9.2, page 146.
    void
    set(int slotIndex, Type type)
    Sets a new Type for the given local variable slot.
    Returns a String representation of this object.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LocalVariables

      public LocalVariables(int localVariableCount)
      Creates a new LocalVariables object.
      Parameters:
      localVariableCount - local variable count.
  • Method Details

    • clone

      public Object clone()
      Returns a deep copy of this object; i.e. the clone operates on a new local variable array. However, the Type objects in the array are shared.
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • get

      public Type get(int slotIndex)
      Returns the type of the local variable slot index.
      Parameters:
      slotIndex - Slot to look up.
      Returns:
      the type of the local variable slot index.
    • getClone

      Returns a (correctly typed) clone of this object. This is equivalent to ((LocalVariables) this.clone()).
      Returns:
      a (correctly typed) clone of this object.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for the object.
    • initializeObject

      public void initializeObject(UninitializedObjectType uninitializedObjectType)
      Replaces all occurrences of uninitializedObjectType in this local variables set with an "initialized" ObjectType.
      Parameters:
      uninitializedObjectType - the object to match.
    • maxLocals

      public int maxLocals()
      Returns the number of local variable slots.
      Returns:
      the number of local variable slots.
    • merge

      public void merge(LocalVariables localVariable)
      Merges two local variables sets as described in the Java Virtual Machine Specification, Second Edition, section 4.9.2, page 146.
      Parameters:
      localVariable - other local variable.
    • set

      public void set(int slotIndex, Type type)
      Sets a new Type for the given local variable slot.
      Parameters:
      slotIndex - Target slot index.
      type - Type to save at the given slot index.
    • toString

      public String toString()
      Returns a String representation of this object.
      Overrides:
      toString in class Object