Class CompileTimeConstantExpressionMatcher
java.lang.Object
com.google.errorprone.matchers.CompileTimeConstantExpressionMatcher
- All Implemented Interfaces:
Matcher<ExpressionTree>, Serializable
A matcher for compile-time-constant expressions.
For the purposes of this matcher, a compile-time constant expression is one of the following:
- Any expression for which the Java compiler can determine a constant value at compile time.
- The expression consisting of the literal
null
. - An expression consisting of a single identifier, where the identifier is a formal method
parameter that is declared
final
and has theCompileTimeConstant
annotation.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
hasCompileTimeConstantAnnotation
(VisitorState state, com.sun.tools.javac.code.Symbol symbol) static Matcher
<ExpressionTree> instance()
boolean
matches
(ExpressionTree t, VisitorState state)
-
Constructor Details
-
CompileTimeConstantExpressionMatcher
public CompileTimeConstantExpressionMatcher()
-
-
Method Details
-
instance
-
matches
- Specified by:
matches
in interfaceMatcher<ExpressionTree>
-
hasCompileTimeConstantAnnotation
public static boolean hasCompileTimeConstantAnnotation(VisitorState state, com.sun.tools.javac.code.Symbol symbol)
-