public class LiteralTreeAnnotator extends TreeAnnotator
QualifierForLiterals
; it is designed to
be added to a ListTreeAnnotator
via GenericAnnotatedTypeFactory.createTreeAnnotator()
LiteralTreeAnnotator
does not traverse trees deeply.
TreeAnnotator
Modifier and Type | Field and Description |
---|---|
protected QualifierHierarchy |
qualHierarchy |
atypeFactory
DEFAULT_VALUE
Constructor and Description |
---|
LiteralTreeAnnotator(AnnotatedTypeFactory atypeFactory)
Creates a
LiteralTreeAnnotator for the given atypeFactory . |
Modifier and Type | Method and Description |
---|---|
void |
addLiteralKind(LiteralKind literalKind,
AnnotationMirror theQual)
Added a rule for a particular
LiteralKind |
LiteralTreeAnnotator |
addStandardLiteralQualifiers()
Adds standard qualifiers for literals.
|
void |
addStringPattern(String pattern,
AnnotationMirror theQual)
Added a rule for all String literals that match the given pattern.
|
Void |
defaultAction(Tree tree,
AnnotatedTypeMirror type) |
Void |
visitLiteral(LiteralTree tree,
AnnotatedTypeMirror type)
Go through the string patterns and add the greatest lower bound of all matching patterns.
|
visitBinary, visitMethod
visit, visit, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitMemberReference, visitMemberSelect, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcard
protected final QualifierHierarchy qualHierarchy
public LiteralTreeAnnotator(AnnotatedTypeFactory atypeFactory)
LiteralTreeAnnotator
for the given atypeFactory
.public LiteralTreeAnnotator addStandardLiteralQualifiers()
DefaultForTypeAnnotator.addStandardDefaults()
.public void addLiteralKind(LiteralKind literalKind, AnnotationMirror theQual)
LiteralKind
literalKind
- LiteralKind
that should be defaulted to theQual
theQual
- the AnnotationMirror
that should be applied to the literalKind
public void addStringPattern(String pattern, AnnotationMirror theQual)
pattern
- pattern to match Strings againsttheQual
- AnnotationMirror
to apply to Strings that match the patternpublic Void defaultAction(Tree tree, AnnotatedTypeMirror type)
defaultAction
in class SimpleTreeVisitor<Void,AnnotatedTypeMirror>
public Void visitLiteral(LiteralTree tree, AnnotatedTypeMirror type)
visitLiteral
in interface TreeVisitor<Void,AnnotatedTypeMirror>
visitLiteral
in class SimpleTreeVisitor<Void,AnnotatedTypeMirror>