Class NullnessNoInitVisitor
- java.lang.Object
-
- com.sun.source.util.TreeScanner<R,P>
-
- com.sun.source.util.TreePathScanner<R,P>
-
- org.checkerframework.framework.source.SourceVisitor<java.lang.Void,java.lang.Void>
-
- org.checkerframework.common.basetype.BaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
- org.checkerframework.checker.nullness.NullnessNoInitVisitor
-
- All Implemented Interfaces:
com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
public class NullnessNoInitVisitor extends BaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
The visitor for the nullness type-system.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
BaseTypeVisitor.FoundRequired, BaseTypeVisitor.OverrideChecker
-
-
Field Summary
-
Fields inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
atypeFactory, checker, DETERMINISTIC, ignoreTargetLocations, IMPURE, methodTree, positions, PURE, qualAllowedLocations, qualHierarchy, showchecks, SIDE_EFFECT_FREE, TARGET, targetValueElement, typeHierarchy, typeValidator, unusedWhenElement
-
Fields inherited from class org.checkerframework.framework.source.SourceVisitor
elements, root, trees, treesWithSuppressWarnings, types
-
-
Constructor Summary
Constructors Constructor Description NullnessNoInitVisitor(BaseTypeChecker checker)Create a new NullnessVisitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, javax.lang.model.element.ExecutableElement constructorElement)Issue a warning if the result type of the constructor declaration is not top.protected voidcheckExceptionParameter(com.sun.source.tree.CatchTree tree)Issue error if the exception parameter is not a supertype of the annotation specified byBaseTypeVisitor.getExceptionParameterLowerBoundAnnotations(), which is top by default.protected voidcheckForRedundantTests(com.sun.source.tree.BinaryTree tree)Reports an error if a comparison of a @NonNull expression with the null literal is performed.protected voidcheckMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method, com.sun.source.tree.MethodInvocationTree tree)Tests whether the method can be invoked using the receiver of the 'tree' method invocation, and issues a "method.invocation.invalid" if the invocation is invalid.protected voidcheckThisOrSuperConstructorCall(com.sun.source.tree.MethodInvocationTree superCall, @CompilerMessageKey java.lang.String errorKey)Checks that the following rule is satisfied: The type on a constructor declaration must be a supertype of the return type of "this()" or "super()" invocation within that constructor.protected voidcheckThrownExpression(com.sun.source.tree.ThrowTree tree)Case 4: Check for thrown exception nullness.protected booleancommonAssignmentCheck(com.sun.source.tree.Tree varTree, com.sun.source.tree.ExpressionTree valueExp, @CompilerMessageKey java.lang.String errorKey, java.lang.Object... extraArgs)Checks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.protected booleancommonAssignmentCheck(AnnotatedTypeMirror varType, com.sun.source.tree.ExpressionTree valueExp, @CompilerMessageKey java.lang.String errorKey, java.lang.Object... extraArgs)Checks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.protected booleancommonAssignmentCheck(AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, com.sun.source.tree.Tree valueTree, @CompilerMessageKey java.lang.String errorKey, java.lang.Object... extraArgs)Checks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.NullnessNoInitAnnotatedTypeFactorycreateTypeFactory()Constructs an instance of the appropriate type factory for the implemented type system.protected TypeValidatorcreateTypeValidator()booleanisValidUse(AnnotatedTypeMirror.AnnotatedPrimitiveType type, com.sun.source.tree.Tree tree)Tests that the qualifiers present on the primitive type are valid.voidprocessClassTree(com.sun.source.tree.ClassTree classTree)Type-check classTree.voidvisitAnnotatedType(@Nullable java.util.List<? extends com.sun.source.tree.AnnotationTree> annoTrees, com.sun.source.tree.Tree typeTree)Checks an annotated type.java.lang.VoidvisitAnnotation(com.sun.source.tree.AnnotationTree tree, java.lang.Void p)Ensure that the annotation arguments comply to their declarations.java.lang.VoidvisitArrayAccess(com.sun.source.tree.ArrayAccessTree tree, java.lang.Void p)Case 3: Check for array dereferencing.java.lang.VoidvisitAssert(com.sun.source.tree.AssertTree tree, java.lang.Void p)java.lang.VoidvisitBinary(com.sun.source.tree.BinaryTree tree, java.lang.Void p)Case 6: Check for redundant nullness tests Case 7: unboxing case: primitive operations.java.lang.VoidvisitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree tree, java.lang.Void p)Case 7: unboxing case: primitive operation.java.lang.VoidvisitConditionalExpression(com.sun.source.tree.ConditionalExpressionTree tree, java.lang.Void p)If the computation of the type of the ConditionalExpressionTree in org.checkerframework.framework.type.TypeFromTree.TypeFromExpression.visitConditionalExpression(ConditionalExpressionTree, AnnotatedTypeFactory) is correct, the following checks are redundant.java.lang.VoidvisitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree tree, java.lang.Void p)java.lang.VoidvisitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree tree, java.lang.Void p)Case 2: Check for implicit.iteratorcall.java.lang.VoidvisitForLoop(com.sun.source.tree.ForLoopTree tree, java.lang.Void p)java.lang.VoidvisitIf(com.sun.source.tree.IfTree tree, java.lang.Void p)java.lang.VoidvisitInstanceOf(com.sun.source.tree.InstanceOfTree tree, java.lang.Void p)java.lang.VoidvisitMemberSelect(com.sun.source.tree.MemberSelectTree tree, java.lang.Void p)Case 1: Check for null dereferencing.java.lang.VoidvisitMethod(com.sun.source.tree.MethodTree tree, java.lang.Void p)Checks that the method obeys override and subtype rules to all overridden methods.java.lang.VoidvisitMethodInvocation(com.sun.source.tree.MethodInvocationTree tree, java.lang.Void p)Performs a method invocation check.java.lang.VoidvisitNewArray(com.sun.source.tree.NewArrayTree tree, java.lang.Void p)java.lang.VoidvisitNewClass(com.sun.source.tree.NewClassTree tree, java.lang.Void p)Performs a new class invocation check.java.lang.VoidvisitSwitch(com.sun.source.tree.SwitchTree tree, java.lang.Void p)java.lang.VoidvisitSynchronized(com.sun.source.tree.SynchronizedTree tree, java.lang.Void p)Case 5: Check for synchronizing locks.java.lang.VoidvisitTypeCast(com.sun.source.tree.TypeCastTree tree, java.lang.Void p)Case 7: unboxing case: casting to a primitive.java.lang.VoidvisitUnary(com.sun.source.tree.UnaryTree tree, java.lang.Void p)Case 7: unboxing case: primitive operation.java.lang.VoidvisitWhileLoop(com.sun.source.tree.WhileLoopTree tree, java.lang.Void p)-
Methods inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
checkAccess, checkAccessAllowed, checkArguments, checkArrayInitialization, checkConditionalPostcondition, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkEnclosingExpr, checkExplicitAnnotationsOnIntersectionBounds, checkExtendsAndImplements, checkExtendsOrImplements, checkFieldInvariantDeclarations, checkForPolymorphicQualifiers, checkForPolymorphicQualifiers, checkMethodReferenceAsOverride, checkOverride, checkOverride, checkPostcondition, checkPreconditions, checkPurity, checkQualifierParameter, checkSuperConstructorCall, checkThisConstructorCall, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckStartDiagnostic, createOverrideChecker, createQualAllowedLocations, createTypeFactoryPublic, enclosingMemberSelect, enclosingStatement, getExceptionParameterLowerBoundAnnotations, getThrowUpperBoundAnnotations, getTypeFactory, isTypeCastSafe, isValidUse, isValidUse, reportCommonAssignmentError, reportMethodInvocabilityError, reportPurityErrors, scan, setRoot, shouldSkipUses, shouldWarnAboutIrrelevantJavaTypes, skipReceiverSubtypeCheck, testAnnotationInsertion, testJointJavacJavaParserVisitor, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateTargetLocation, validateType, validateTypeOf, validateVariablesTargetLocation, visitAnnotatedType, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitIdentifier, visitLambdaExpression, visitMemberReference, visitReturn, visitSwitchExpression17, visitThrow, visitTypeParameter, visitVariable, warnAboutIrrelevantJavaTypes, warnRedundantAnnotations
-
Methods inherited from class org.checkerframework.framework.source.SourceVisitor
visit
-
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitArrayType, visitBlock, visitBreak, visitCase, visitContinue, visitEmptyStatement, visitErroneous, visitExports, visitExpressionStatement, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitModifiers, visitModule, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitTry, visitUnionType, visitUses, visitWildcard
-
-
-
-
Constructor Detail
-
NullnessNoInitVisitor
public NullnessNoInitVisitor(BaseTypeChecker checker)
Create a new NullnessVisitor.- Parameters:
checker- the checker to which this visitor belongs
-
-
Method Detail
-
createTypeFactory
public NullnessNoInitAnnotatedTypeFactory createTypeFactory()
Description copied from class:BaseTypeVisitorConstructs an instance of the appropriate type factory for the implemented type system.The default implementation uses the checker naming convention to create the appropriate type factory. If no factory is found, it returns
BaseAnnotatedTypeFactory. It reflectively invokes the constructor that accepts this checker and compilation unit tree (in that order) as arguments.Subclasses have to override this method to create the appropriate visitor if they do not follow the checker naming convention.
- Overrides:
createTypeFactoryin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Returns:
- the appropriate type factory
-
isValidUse
public boolean isValidUse(AnnotatedTypeMirror.AnnotatedPrimitiveType type, com.sun.source.tree.Tree tree)
Description copied from class:BaseTypeVisitorTests that the qualifiers present on the primitive type are valid.- Overrides:
isValidUsein classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
type- the use of the primitive typetree- the tree where the type is used- Returns:
- true if the type is a valid use of the primitive type
-
checkConstructorResult
protected void checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, javax.lang.model.element.ExecutableElement constructorElement)
Description copied from class:BaseTypeVisitorIssue a warning if the result type of the constructor declaration is not top. If it is a supertype of the class, then a type.invalid.conflicting.annos error will also be issued byBaseTypeVisitor.isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType,AnnotatedTypeMirror.AnnotatedDeclaredType,Tree).- Overrides:
checkConstructorResultin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
constructorType- the AnnotatedExecutableType for the constructorconstructorElement- the element that declares the constructor
-
checkThisOrSuperConstructorCall
protected void checkThisOrSuperConstructorCall(com.sun.source.tree.MethodInvocationTree superCall, @CompilerMessageKey java.lang.String errorKey)Description copied from class:BaseTypeVisitorChecks that the following rule is satisfied: The type on a constructor declaration must be a supertype of the return type of "this()" or "super()" invocation within that constructor.- Overrides:
checkThisOrSuperConstructorCallin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
superCall- the AST node for the constructor callerrorKey- the error message key to use if the check fails
-
commonAssignmentCheck
protected boolean commonAssignmentCheck(com.sun.source.tree.Tree varTree, com.sun.source.tree.ExpressionTree valueExp, @CompilerMessageKey java.lang.String errorKey, java.lang.Object... extraArgs)Description copied from class:BaseTypeVisitorChecks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.- Overrides:
commonAssignmentCheckin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
varTree- the AST node for the lvalue (usually a variable)valueExp- the AST node for the rvalue (the new value)errorKey- the error message key to use if the check failsextraArgs- arguments to the error message key, before "found" and "expected" types- Returns:
- true if the check succeeds, false if an error message was issued
-
commonAssignmentCheck
protected boolean commonAssignmentCheck(AnnotatedTypeMirror varType, com.sun.source.tree.ExpressionTree valueExp, @CompilerMessageKey java.lang.String errorKey, java.lang.Object... extraArgs)
Description copied from class:BaseTypeVisitorChecks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.- Overrides:
commonAssignmentCheckin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
varType- the annotated type for the lvalue (usually a variable)valueExp- the AST node for the rvalue (the new value)errorKey- the error message key to use if the check failsextraArgs- arguments to the error message key, before "found" and "expected" types- Returns:
- true if the check succeeds, false if an error message was issued
-
commonAssignmentCheck
@FormatMethod protected boolean commonAssignmentCheck(AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, com.sun.source.tree.Tree valueTree, @CompilerMessageKey java.lang.String errorKey, java.lang.Object... extraArgs)
Description copied from class:BaseTypeVisitorChecks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.- Overrides:
commonAssignmentCheckin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
varType- the annotated type of the variablevalueType- the annotated type of the valuevalueTree- the location to use when reporting the error messageerrorKey- the error message key to use if the check failsextraArgs- arguments to the error message key, before "found" and "expected" types- Returns:
- true if the check succeeds, false if an error message was issued
-
visitMemberSelect
public java.lang.Void visitMemberSelect(com.sun.source.tree.MemberSelectTree tree, java.lang.Void p)Case 1: Check for null dereferencing.- Specified by:
visitMemberSelectin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitMemberSelectin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitEnhancedForLoop
public java.lang.Void visitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree tree, java.lang.Void p)Case 2: Check for implicit.iteratorcall.- Specified by:
visitEnhancedForLoopin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitEnhancedForLoopin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
visitArrayAccess
public java.lang.Void visitArrayAccess(com.sun.source.tree.ArrayAccessTree tree, java.lang.Void p)Case 3: Check for array dereferencing.- Specified by:
visitArrayAccessin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitArrayAccessin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitNewArray
public java.lang.Void visitNewArray(com.sun.source.tree.NewArrayTree tree, java.lang.Void p)- Specified by:
visitNewArrayin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitNewArrayin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
checkThrownExpression
protected void checkThrownExpression(com.sun.source.tree.ThrowTree tree)
Case 4: Check for thrown exception nullness.- Overrides:
checkThrownExpressionin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
tree- a ThrowTree to check
-
visitSynchronized
public java.lang.Void visitSynchronized(com.sun.source.tree.SynchronizedTree tree, java.lang.Void p)Case 5: Check for synchronizing locks.- Specified by:
visitSynchronizedin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitSynchronizedin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitAssert
public java.lang.Void visitAssert(com.sun.source.tree.AssertTree tree, java.lang.Void p)- Specified by:
visitAssertin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitAssertin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitIf
public java.lang.Void visitIf(com.sun.source.tree.IfTree tree, java.lang.Void p)- Specified by:
visitIfin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitIfin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitInstanceOf
public java.lang.Void visitInstanceOf(com.sun.source.tree.InstanceOfTree tree, java.lang.Void p)- Specified by:
visitInstanceOfin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitInstanceOfin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
checkForRedundantTests
protected void checkForRedundantTests(com.sun.source.tree.BinaryTree tree)
Reports an error if a comparison of a @NonNull expression with the null literal is performed.- Parameters:
tree- a tree that might be a comparison of a @NonNull expression with the null literal
-
visitBinary
public java.lang.Void visitBinary(com.sun.source.tree.BinaryTree tree, java.lang.Void p)Case 6: Check for redundant nullness tests Case 7: unboxing case: primitive operations.- Specified by:
visitBinaryin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitBinaryin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitUnary
public java.lang.Void visitUnary(com.sun.source.tree.UnaryTree tree, java.lang.Void p)Case 7: unboxing case: primitive operation.- Specified by:
visitUnaryin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitUnaryin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
visitCompoundAssignment
public java.lang.Void visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree tree, java.lang.Void p)Case 7: unboxing case: primitive operation.- Specified by:
visitCompoundAssignmentin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitCompoundAssignmentin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
visitTypeCast
public java.lang.Void visitTypeCast(com.sun.source.tree.TypeCastTree tree, java.lang.Void p)Case 7: unboxing case: casting to a primitive.- Specified by:
visitTypeCastin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitTypeCastin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
visitMethod
public java.lang.Void visitMethod(com.sun.source.tree.MethodTree tree, java.lang.Void p)Description copied from class:BaseTypeVisitorChecks that the method obeys override and subtype rules to all overridden methods. (Uses the pseudo-assignment logic to do so.)The override rule specifies that a method, m1, may override a method m2 only if:
- m1 return type is a subtype of m2
- m1 receiver type is a supertype of m2
- m1 parameters are supertypes of corresponding m2 parameters
- Specified by:
visitMethodin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitMethodin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
visitMethodInvocation
public java.lang.Void visitMethodInvocation(com.sun.source.tree.MethodInvocationTree tree, java.lang.Void p)Description copied from class:BaseTypeVisitorPerforms a method invocation check.An invocation of a method, m, on the receiver, r is valid only if:
- passed arguments are subtypes of corresponding m parameters
- r is a subtype of m receiver type
- if m is generic, passed type arguments are subtypes of m type variables
- Specified by:
visitMethodInvocationin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitMethodInvocationin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
processClassTree
public void processClassTree(com.sun.source.tree.ClassTree classTree)
Description copied from class:BaseTypeVisitorType-check classTree. Subclasses should override this method instead ofBaseTypeVisitor.visitClass(ClassTree, Void).- Overrides:
processClassTreein classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
classTree- class to check
-
checkMethodInvocability
protected void checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method, com.sun.source.tree.MethodInvocationTree tree)
Description copied from class:BaseTypeVisitorTests whether the method can be invoked using the receiver of the 'tree' method invocation, and issues a "method.invocation.invalid" if the invocation is invalid.This implementation tests whether the receiver in the method invocation is a subtype of the method receiver type. This behavior can be specialized by overriding skipReceiverSubtypeCheck.
- Overrides:
checkMethodInvocabilityin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
method- the type of the invoked methodtree- the method invocation tree
-
visitSwitch
public java.lang.Void visitSwitch(com.sun.source.tree.SwitchTree tree, java.lang.Void p)- Specified by:
visitSwitchin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitSwitchin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitForLoop
public java.lang.Void visitForLoop(com.sun.source.tree.ForLoopTree tree, java.lang.Void p)- Specified by:
visitForLoopin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitForLoopin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitNewClass
public java.lang.Void visitNewClass(com.sun.source.tree.NewClassTree tree, java.lang.Void p)Description copied from class:BaseTypeVisitorPerforms a new class invocation check.An invocation of a constructor, c, is valid only if:
- passed arguments are subtypes of corresponding c parameters
- if c is generic, passed type arguments are subtypes of c type variables
- Specified by:
visitNewClassin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitNewClassin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
visitWhileLoop
public java.lang.Void visitWhileLoop(com.sun.source.tree.WhileLoopTree tree, java.lang.Void p)- Specified by:
visitWhileLoopin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitWhileLoopin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitDoWhileLoop
public java.lang.Void visitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree tree, java.lang.Void p)- Specified by:
visitDoWhileLoopin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitDoWhileLoopin classcom.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
-
visitConditionalExpression
public java.lang.Void visitConditionalExpression(com.sun.source.tree.ConditionalExpressionTree tree, java.lang.Void p)Description copied from class:BaseTypeVisitorIf the computation of the type of the ConditionalExpressionTree in org.checkerframework.framework.type.TypeFromTree.TypeFromExpression.visitConditionalExpression(ConditionalExpressionTree, AnnotatedTypeFactory) is correct, the following checks are redundant. However, let's add another failsafe guard and do the checks.- Specified by:
visitConditionalExpressionin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitConditionalExpressionin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
checkExceptionParameter
protected void checkExceptionParameter(com.sun.source.tree.CatchTree tree)
Description copied from class:BaseTypeVisitorIssue error if the exception parameter is not a supertype of the annotation specified byBaseTypeVisitor.getExceptionParameterLowerBoundAnnotations(), which is top by default.Subclasses may override this method to change the behavior of this check. Subclasses wishing to enforce that exception parameter be annotated with other annotations can just override
BaseTypeVisitor.getExceptionParameterLowerBoundAnnotations().- Overrides:
checkExceptionParameterin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
tree- a CatchTree to check
-
visitAnnotation
public java.lang.Void visitAnnotation(com.sun.source.tree.AnnotationTree tree, java.lang.Void p)Description copied from class:BaseTypeVisitorEnsure that the annotation arguments comply to their declarations. This needs some special casing, as annotation arguments form special trees.- Specified by:
visitAnnotationin interfacecom.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>- Overrides:
visitAnnotationin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
visitAnnotatedType
public void visitAnnotatedType(@Nullable java.util.List<? extends com.sun.source.tree.AnnotationTree> annoTrees, com.sun.source.tree.Tree typeTree)
Description copied from class:BaseTypeVisitorChecks an annotated type. Invoked byBaseTypeVisitor.visitAnnotatedType(AnnotatedTypeTree, Void),BaseTypeVisitor.visitVariable(com.sun.source.tree.VariableTree, java.lang.Void), andBaseTypeVisitor.visitMethod(com.sun.source.tree.MethodTree, java.lang.Void). Exists to prevent code duplication among the three. Checking invisitVariableandvisitMethodis needed because there isn't an AnnotatedTypeTree within a variable declaration or for a method return type -- all the annotations are attached to the VariableTree or MethodTree, respectively.- Overrides:
visitAnnotatedTypein classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>- Parameters:
annoTrees- annotations written before a variable/method declaration, if this type is from one; null otherwise. This might contain type annotations that the Java parser attached to the declaration rather than to the type.typeTree- the type that any type annotations in annoTrees apply to
-
createTypeValidator
protected TypeValidator createTypeValidator()
- Overrides:
createTypeValidatorin classBaseTypeVisitor<NullnessNoInitAnnotatedTypeFactory>
-
-