Class ConstantFold

java.lang.Object
org.openrewrite.analysis.constantfold.ConstantFold

@Incubating(since="2.4.0") public class ConstantFold extends Object
  • Constructor Details

    • ConstantFold

      public ConstantFold()
  • Method Details

    • findConstantJ

      public static fj.data.Option<org.openrewrite.java.tree.J> findConstantJ(org.openrewrite.Cursor cursor)
      Find the constant value that is being assigned to a variable, if any. Otherwise, return the J itself.
    • findConstantExpr

      public static fj.data.Option<org.openrewrite.analysis.trait.expr.Expr> findConstantExpr(org.openrewrite.Cursor cursor)
      Find the constant expression that is being assigned to a variable, if any. Otherwise, return the expression itself.
    • findConstantExpr

      public static fj.data.Option<org.openrewrite.analysis.trait.expr.Expr> findConstantExpr(DataFlowNode node)
      Find the constant expression that is being assigned to a variable, if any. Otherwise, return the expression itself.
    • findConstantLiteral

      public static fj.data.Option<org.openrewrite.analysis.trait.expr.Literal> findConstantLiteral(org.openrewrite.Cursor cursor)
    • findConstantLiteral

      public static fj.data.Option<org.openrewrite.analysis.trait.expr.Literal> findConstantLiteral(DataFlowNode node)
    • findConstantLiteralValue

      public static <T> fj.data.Option<T> findConstantLiteralValue(org.openrewrite.Cursor cursor, Class<T> type)
    • findConstantLiteralValue

      public static <T> fj.data.Option<T> findConstantLiteralValue(DataFlowNode node, Class<T> type)