Class ConstantExpressions
java.lang.Object
com.google.errorprone.bugpatterns.threadsafety.ConstantExpressions
Helper for establishing whether expressions correspond to a constant expression.
-
Nested Class Summary
Nested ClassesModifier 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
(ExpressionTree tree, VisitorState state) static ConstantExpressions
fromFlags
(ErrorProneFlags flags) boolean
isSame
(ExpressionTree aTree, ExpressionTree bTree, VisitorState state) Returns whetheraTree
andbTree
seem to correspond to the same expression.symbolizeImmutableExpression
(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
(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(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(ExpressionTree tree, VisitorState state) -
isSame
Returns whetheraTree
andbTree
seem to correspond to the same expression. -
symbolizeImmutableExpression
public Optional<ConstantExpressions.PureMethodInvocation> symbolizeImmutableExpression(ExpressionTree tree, VisitorState state) Returns a list of the methods called to get to this expression, as well as a terminating variable if needed.
-