Class AbstractStmt

java.lang.Object
sootup.core.jimple.common.stmt.AbstractStmt
All Implemented Interfaces:
EquivTo, Stmt, Acceptor<StmtVisitor>
Direct Known Subclasses:
AbstractDefinitionStmt, JBreakpointStmt, JEnterMonitorStmt, JExitMonitorStmt, JGotoStmt, JIfStmt, JInvokeStmt, JNopStmt, JRetStmt, JReturnStmt, JReturnVoidStmt, JSwitchStmt, JThrowStmt

public abstract class AbstractStmt extends Object implements Stmt
  • Field Details

  • Constructor Details

  • Method Details

    • getUses

      @Nonnull public Stream<Value> getUses()
      Returns a list of Values used in this Stmt. Note that they are returned in usual evaluation order.
      Specified by:
      getUses in interface Stmt
    • getDef

      @Nonnull public Optional<LValue> getDef()
      Returns a list of Values defined in this Stmt. There are languages which allow multiple return types/assignments so we return a List
      Specified by:
      getDef in interface Stmt
    • getUsesAndDefs

      @Nonnull public Stream<Value> getUsesAndDefs()
      Returns a list of Values, either used or defined or both in this Stmt.
      Specified by:
      getUsesAndDefs in interface Stmt
    • getExpectedSuccessorCount

      public int getExpectedSuccessorCount()
      Returns the amount of unexceptional successors the Stmt needs to have in the StmtGraph.
      Specified by:
      getExpectedSuccessorCount in interface Stmt
    • containsArrayRef

      public boolean containsArrayRef()
      Specified by:
      containsArrayRef in interface Stmt
    • getArrayRef

      public JArrayRef getArrayRef()
      This method must only be used for Stmts which contain an ArrayRef - possible with JAssignStmts. check via containsArrayRef().
      Specified by:
      getArrayRef in interface Stmt
    • containsFieldRef

      public boolean containsFieldRef()
      Specified by:
      containsFieldRef in interface Stmt
    • getFieldRef

      public JFieldRef getFieldRef()
      This method must only be used for Stmts which contain an FieldRef - possible with JAssignStmts. check via containsFieldRef().
      Specified by:
      getFieldRef in interface Stmt
    • getPositionInfo

      public StmtPositionInfo getPositionInfo()
      Specified by:
      getPositionInfo in interface Stmt
    • withNewUse

      public Stmt withNewUse(@Nonnull Value oldUse, @Nonnull Value newUse)
      Use newUse to replace the oldUse in oldStmt.
      Specified by:
      withNewUse in interface Stmt
      Parameters:
      oldUse - a Value in the useList of oldStmt.
      newUse - a Value is to replace oldUse
      Returns:
      a new Stmt with newUse or the current Stmt if oldUse was not found/could not be replaced in the Stmt
    • isInvokableStmt

      public boolean isInvokableStmt()
      Checks if the statement is an invokable statement, this means it either contains an invoke expression or causes a static initializer call
      Specified by:
      isInvokableStmt in interface Stmt
      Returns:
      true if the Object is an instance of InvokableStmt, otherwise false
    • asInvokableStmt

      public InvokableStmt asInvokableStmt()
      Transforms the statement to an InvokableStmt if it is possible. if not it will throw an Exception. Before this method is used isInvokableStmt() should be called to prevent exceptions
      Specified by:
      asInvokableStmt in interface Stmt
      Returns:
      the typecast of this to InvokableStmt