Class ConstantExpressions
java.lang.Object
com.google.errorprone.bugpatterns.threadsafety.ConstantExpressions
Helper for establishing whether expressions correspond to a constant expression.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a binary equals call on two constant expressions.static class
Represents a constant expression.static interface
Visitor for scanning over the components of a constant expression.static class
Represents both a constant method call or a constant field/local access, depending on the actual type ofsymbol
.static class
Represents sets of things known to be true and false if a boolean statement evaluated true. -
Method Summary
Modifier and TypeMethodDescriptionconstantExpression
(com.sun.source.tree.ExpressionTree tree, VisitorState state) static ConstantExpressions
fromFlags
(ErrorProneFlags flags) 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.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.
-