Class ConstantPropagationAnalysis
java.lang.Object
com.google.errorprone.dataflow.ConstantPropagationAnalysis
An interface to the constant propagation analysis.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Number
numberValue
(com.sun.source.util.TreePath exprPath, com.sun.tools.javac.util.Context context) Returns the value of the leaf ofexprPath
, if it is determined to be a constant (always evaluates to the same numeric value), and null otherwise.
-
Method Details
-
numberValue
public static @Nullable Number numberValue(com.sun.source.util.TreePath exprPath, com.sun.tools.javac.util.Context context) Returns the value of the leaf ofexprPath
, if it is determined to be a constant (always evaluates to the same numeric value), and null otherwise. Note that returning null does not necessarily mean the expression is *not* a constant.
-