public class FenumVisitor extends BaseTypeVisitor<FenumChecker>
BaseTypeVisitor.TypeValidator
annoFactory, annoTypes, checker, options, typeValidator, visitorState
atypeFactory, elements, root, trees, types
Constructor and Description |
---|
FenumVisitor(FenumChecker checker,
@Nullable CompilationUnitTree root) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkConstructorInvocation(AnnotatedTypeMirror.AnnotatedDeclaredType dt,
AnnotatedTypeMirror.AnnotatedExecutableType constructor,
@Nullable Tree src) |
boolean |
isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType declarationType,
AnnotatedTypeMirror.AnnotatedDeclaredType useType)
Tests that the qualifiers present on the useType are valid qualifiers,
given the qualifiers on the declaration of the type, declarationType.
|
@Nullable Void |
visitBinary(BinaryTree node,
@Nullable Void p) |
@Nullable Void |
visitCompoundAssignment(CompoundAssignmentTree node,
@Nullable Void p)
Performs assignability check using
BaseTypeVisitor.checkAssignability(AnnotatedTypeMirror, Tree) . |
@Nullable Void |
visitSwitch(SwitchTree node,
@Nullable Void p) |
checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkDefaultConstructor, checkForAnnotatedJdk, checkMethodInvocability, checkOverride, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, createTypeValidator, enclosingMemberSelect, enclosingStatement, isAccessAllowed, isAssignable, isValidUse, isValidUse, isVectorCopyInto, scan, shouldSkipUses, typeCheckVectorCopyIntoArgument, validateTypeOf, visitAnnotation, visitArrayAccess, visitAssignment, visitClass, visitCompilationUnit, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitTypeCast, visitTypeParameter, visitUnary, visitVariable
getCurrentPath, scan
reduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBlock, visitBreak, visitCase, visitCatch, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSynchronized, visitThrow, visitTry, visitUnionType, visitWhileLoop, visitWildcard
public FenumVisitor(FenumChecker checker, @Nullable CompilationUnitTree root)
public @Nullable Void visitBinary(BinaryTree node, @Nullable Void p)
visitBinary
in interface TreeVisitor<@Nullable Void,@Nullable Void>
visitBinary
in class TreeScanner<@Nullable Void,@Nullable Void>
public @Nullable Void visitCompoundAssignment(CompoundAssignmentTree node, @Nullable Void p)
BaseTypeVisitor
BaseTypeVisitor.checkAssignability(AnnotatedTypeMirror, Tree)
.visitCompoundAssignment
in interface TreeVisitor<@Nullable Void,@Nullable Void>
visitCompoundAssignment
in class BaseTypeVisitor<FenumChecker>
public @Nullable Void visitSwitch(SwitchTree node, @Nullable Void p)
visitSwitch
in interface TreeVisitor<@Nullable Void,@Nullable Void>
visitSwitch
in class TreeScanner<@Nullable Void,@Nullable Void>
protected boolean checkConstructorInvocation(AnnotatedTypeMirror.AnnotatedDeclaredType dt, AnnotatedTypeMirror.AnnotatedExecutableType constructor, @Nullable Tree src)
checkConstructorInvocation
in class BaseTypeVisitor<FenumChecker>
public boolean isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType declarationType, AnnotatedTypeMirror.AnnotatedDeclaredType useType)
BaseTypeVisitor
The check is shallow, as it does not descend into generic or array
types (i.e. only performing the validity check on the raw type or
outermost array dimension). BaseTypeVisitor.validateTypeOf(Tree)
would call this for each type argument or array dimension separately.
For instance, in the IGJ type system, a @Mutable
is an invalid
qualifier for String
, as String
is declared as
@Immutable String
.
In most cases, useType
simply needs to be a subtype of
declarationType
, but there are exceptions. In IGJ, a variable may be
declared @ReadOnly String
, even though String
is
@Immutable String
; ReadOnly
is not a subtype of
Immutable
.
isValidUse
in class BaseTypeVisitor<FenumChecker>
declarationType
- the type of the class (TypeElement)useType
- the use of the class (instance type)