Class ConstantExpressions
java.lang.Object
com.google.errorprone.bugpatterns.threadsafety.ConstantExpressions
public final class ConstantExpressions extends Object
Helper for establishing whether expressions correspond to a constant expression.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConstantExpressions.ConstantEquals
Represents a binary equals call on two constant expressions.static class
ConstantExpressions.ConstantExpression
Represents a constant expression.static interface
ConstantExpressions.ConstantExpressionVisitor
Visitor for scanning over the components of a constant expression.static class
ConstantExpressions.PureMethodInvocation
Represents both a constant method call or a constant field/local access, depending on the actual type ofsymbol
.static class
ConstantExpressions.Truthiness
Represents sets of things known to be true and false if a boolean statement evaluated true. -
Method Summary
Modifier and Type Method Description Optional<ConstantExpressions.ConstantExpression>
constantExpression(com.sun.source.tree.ExpressionTree tree, VisitorState state)
static ConstantExpressions
fromFlags(ErrorProneFlags flags)
Optional<ConstantExpressions.PureMethodInvocation>
symbolizeImmutableExpression(com.sun.source.tree.ExpressionTree tree, VisitorState state)
Returns a list of the methods called to get to this expression, as well as a terminating variable if needed.ConstantExpressions.Truthiness
truthiness(com.sun.source.tree.ExpressionTree tree, boolean not, VisitorState state)
Scans anExpressionTree
to find anything guaranteed to be false or true if this expression is true.
-
Method Details
-
fromFlags
-
truthiness
public ConstantExpressions.Truthiness truthiness(com.sun.source.tree.ExpressionTree tree, boolean not, VisitorState state)Scans anExpressionTree
to find anything guaranteed to be false or true if this expression is true. -
constantExpression
public Optional<ConstantExpressions.ConstantExpression> constantExpression(com.sun.source.tree.ExpressionTree tree, VisitorState state) -
symbolizeImmutableExpression
public Optional<ConstantExpressions.PureMethodInvocation> symbolizeImmutableExpression(com.sun.source.tree.ExpressionTree tree, VisitorState state)Returns a list of the methods called to get to this expression, as well as a terminating variable if needed.
-