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 classRepresents a binary equals call on two constant expressions.static classRepresents a constant expression.static interfaceVisitor for scanning over the components of a constant expression.static classRepresents both a constant method call or a constant field/local access, depending on the actual type ofsymbol.static classRepresents 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 ConstantExpressionsfromFlags(ErrorProneFlags flags) booleanisSame(ExpressionTree aTree, ExpressionTree bTree, VisitorState state) Returns whetheraTreeandbTreeseem 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 anExpressionTreeto 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 anExpressionTreeto 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 whetheraTreeandbTreeseem 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.
-