public final class InterningVisitor extends BaseTypeVisitor<InterningAnnotatedTypeFactory>
Interned
or InternedDistinct
. This visitor reports errors or
warnings for violations for the following cases:
BaseTypeVisitor
BaseTypeVisitor.OverrideChecker
atypeFactory, checker, positions, TARGET, targetValueElement, typeValidator, unusedWhenElement, visitorState
elements, root, trees, treesWithSuppressWarnings, types
Constructor and Description |
---|
InterningVisitor(BaseTypeChecker checker)
Create an InterningVisitor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType,
ExecutableElement constructorElement)
Issue a warning if the result type of the constructor is not top.
|
protected boolean |
isTypeCastSafe(AnnotatedTypeMirror castType,
AnnotatedTypeMirror exprType)
Returns true if the cast is safe.
|
void |
processClassTree(ClassTree classTree)
Method to implement the @UsesObjectEquals functionality.
|
boolean |
validateTypeOf(Tree tree)
Tests whether the tree expressed by the passed type tree is a valid type, and emits an error if
that is not the case (e.g.
|
Void |
visitBinary(BinaryTree node,
Void p)
Checks comparison operators, == and !=, for INTERNING violations.
|
Void |
visitMethod(MethodTree node,
Void p)
Performs pseudo-assignment check: checks that the method obeys override and subtype rules to
all overridden methods.
|
Void |
visitMethodInvocation(MethodInvocationTree node,
Void p)
If lint option "dotequals" is specified, warn if the .equals method is used where reference
equality is safe.
|
checkAccess, checkAccessAllowed, checkArguments, checkArrayInitialization, checkConditionalPostcondition, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkExplicitAnnotationsOnIntersectionBounds, checkExtendsImplements, checkFieldInvariantDeclarations, checkForPolymorphicQualifiers, checkForPolymorphicQualifiers, checkMethodInvocability, checkMethodReferenceAsOverride, checkOverride, checkOverride, checkPostcondition, checkPreconditions, checkPurity, checkQualifierParameter, checkSuperConstructorCall, checkThisConstructorCall, checkThisOrSuperConstructorCall, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckStartDiagnostic, createOverrideChecker, createTypeFactory, createTypeFactoryPublic, createTypeValidator, enclosingMemberSelect, enclosingStatement, getExceptionParameterLowerBoundAnnotations, getThrowUpperBoundAnnotations, getTypeFactory, isValidUse, isValidUse, isValidUse, reportMethodInvocabilityError, reportPurityErrors, scan, setRoot, shouldSkipUses, skipReceiverSubtypeCheck, testAnnotationInsertion, testJointJavacJavaParserVisitor, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, visitAnnotatedType, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitNewArray, visitNewClass, visitReturn, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, warnAboutIrrelevantJavaTypes
visit
getCurrentPath, scan
reduce, scan, visitArrayType, visitAssert, visitBlock, visitBreak, visitCase, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitModule, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitSwitch, visitSynchronized, visitTry, visitUnionType, visitUses, visitWhileLoop, visitWildcard
public InterningVisitor(BaseTypeChecker checker)
public Void visitBinary(BinaryTree node, Void p)
visitBinary
in interface TreeVisitor<Void,Void>
visitBinary
in class TreeScanner<Void,Void>
public Void visitMethodInvocation(MethodInvocationTree node, Void p)
visitMethodInvocation
in interface TreeVisitor<Void,Void>
visitMethodInvocation
in class BaseTypeVisitor<InterningAnnotatedTypeFactory>
public Void visitMethod(MethodTree node, Void p)
BaseTypeVisitor
The override rule specifies that a method, m1, may override a method m2 only if:
visitMethod
in interface TreeVisitor<Void,Void>
visitMethod
in class BaseTypeVisitor<InterningAnnotatedTypeFactory>
public void processClassTree(ClassTree classTree)
processClassTree
in class BaseTypeVisitor<InterningAnnotatedTypeFactory>
classTree
- class to checkSourceVisitor.visitClass(com.sun.source.tree.ClassTree,
java.lang.Object)
protected void checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, ExecutableElement constructorElement)
BaseTypeVisitor
BaseTypeVisitor.isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType,AnnotatedTypeMirror.AnnotatedDeclaredType,Tree)
.checkConstructorResult
in class BaseTypeVisitor<InterningAnnotatedTypeFactory>
constructorType
- AnnotatedExecutableType for the constructorconstructorElement
- element that declares the constructorpublic boolean validateTypeOf(Tree tree)
BaseTypeVisitor
validateTypeOf
in class BaseTypeVisitor<InterningAnnotatedTypeFactory>
tree
- the AST type supplied by the userprotected boolean isTypeCastSafe(AnnotatedTypeMirror castType, AnnotatedTypeMirror exprType)
BaseTypeVisitor
Only primary qualifiers are checked unless the command line option "checkCastElementType" is supplied.
isTypeCastSafe
in class BaseTypeVisitor<InterningAnnotatedTypeFactory>
castType
- annotated type of the castexprType
- annotated type of the casted expression