Class ConstantExpr

All Implemented Interfaces:
LeafExpr, Cloneable

public class ConstantExpr extends Expr implements LeafExpr
ConstantExpr represents a constant expression. It is used when opcodes ldc, iinc, and getstatic are visited. It value must be an Integer, Long, Float, Double, or String.
  • Constructor Details

    • ConstantExpr

      public ConstantExpr(Object value, Type type)
      Constructor.
      Parameters:
      value - The operand of the ldc instruction
      type - The Type of the operand
  • Method Details

    • value

      public Object value()
      Returns:
      The operand of the ldc instruction
    • visitForceChildren

      public void visitForceChildren(TreeVisitor visitor)
      Description copied from class: Node
      Visit the children of this node. Not all Nodes will have children to visit.
      Specified by:
      visitForceChildren in class Node
    • visit

      public void visit(TreeVisitor visitor)
      Specified by:
      visit in class Node
    • exprHashCode

      public int exprHashCode()
      Description copied from class: Expr
      Returns the hash code for this expresion.
      Specified by:
      exprHashCode in class Expr
      Returns:
      A hash code for this expression.
    • equalsExpr

      public boolean equalsExpr(Expr other)
      Compare this ConstantExpr to another Expr.
      Specified by:
      equalsExpr in class Expr
      Parameters:
      other - An Expr to compare this to.
      Returns:
      True, if this and other are the same (that is, have the same contents).
    • clone

      public Object clone()
      Specified by:
      clone in class Expr