Class Local

java.lang.Object
sootup.core.jimple.basic.Local
All Implemented Interfaces:
EquivTo, Immediate, LValue, Value, Acceptor<ImmediateVisitor>
Direct Known Subclasses:
JavaLocal

public class Local extends Object implements Immediate, LValue, Acceptor<ImmediateVisitor>
Local variable in Body. Use LocalGenerator to generate locals.

Prefer to use the factory methods in Jimple.

Author:
Linghui Luo
  • Constructor Details

    • Local

      public Local(@NonNull String name, @NonNull Type type)
      Constructs a JimpleLocal of the given name and type.
  • Method Details

    • equals

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

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equivTo

      public boolean equivTo(@NonNull Object o, @NonNull JimpleComparator comparator)
      Description copied from interface: EquivTo
      Returns true if this object is equivalent to o according to the given comparator.
      Specified by:
      equivTo in interface EquivTo
    • equivHashCode

      public int equivHashCode()
      Description copied from interface: EquivTo
      Returns a (not necessarily fixed) hash code for this object. This hash code coincides with equivTo; it is undefined in the presence of mutable objects. The contract is defined in JimpleComparator.
      Specified by:
      equivHashCode in interface EquivTo
    • getName

      public @NonNull String getName()
      Returns the name of this object.
    • getType

      public @NonNull Type getType()
      Returns the type of this local.
      Specified by:
      getType in interface Value
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public void toString(@NonNull StmtPrinter up)
      Specified by:
      toString in interface Value
    • getUses

      public @NonNull Stream<Value> getUses()
      Description copied from interface: Value
      Returns a List of Locals,FieldRefs,ArrayRefs which are used by (ie contained within) this Expression or Reference.
      Specified by:
      getUses in interface Value
      Returns:
    • getDefs

      public List<AbstractDefinitionStmt> getDefs(Collection<Stmt> defs)
      returns a List that can contain: Locals, JFieldRefs, JArrayRefs
    • getDefsForLocalUse

      public List<Stmt> getDefsForLocalUse(StmtGraph<?> graph, Stmt stmt)
      Get all definition-stmts which define the given local used by the given stmt.
      Parameters:
      graph - a stmt graph which contains the given stmts.
      stmt - a stmt which uses the given local.
    • getStmtsUsingOrDefiningthisLocal

      public List<Stmt> getStmtsUsingOrDefiningthisLocal(Collection<Stmt> stmts, Stmt removedStmt)
    • accept

      public <V extends ImmediateVisitor> V accept(@NonNull V v)
      Description copied from interface: Acceptor
      Called when this object is visited.
      Specified by:
      accept in interface Acceptor<ImmediateVisitor>
    • withName

      public @NonNull Local withName(@NonNull String name)
    • withType

      public @NonNull Local withType(@NonNull Type type)