Class FenumVisitor
- All Implemented Interfaces:
- TreeVisitor<Void,- Void> 
- 
Nested Class SummaryNested classes/interfaces inherited from class org.checkerframework.common.basetype.BaseTypeVisitorBaseTypeVisitor.OverrideChecker
- 
Field SummaryFields inherited from class org.checkerframework.common.basetype.BaseTypeVisitoratypeFactory, checker, DETERMINISTIC, methodTree, positions, PURE, showchecks, SIDE_EFFECT_FREE, TARGET, targetValueElement, typeValidator, unusedWhenElementFields inherited from class org.checkerframework.framework.source.SourceVisitorelements, root, trees, treesWithSuppressWarnings, types
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcheckConstructorInvocation(AnnotatedTypeMirror.AnnotatedDeclaredType dt, AnnotatedTypeMirror.AnnotatedExecutableType constructor, NewClassTree src) Check that the (explicit) annotations on a new class tree are comparable to the result type of the constructor.protected voidcheckConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, ExecutableElement constructorElement) Issue a warning if the result type of the constructor is not top.protected Set<? extends AnnotationMirror>Returns a set of AnnotationMirrors that is a lower bound for exception parameters.booleanisValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType declarationType, AnnotatedTypeMirror.AnnotatedDeclaredType useType, Tree tree) Tests that the qualifiers present onuseTypeare valid qualifiers, given the qualifiers on the declaration of the type,declarationType.visitBinary(BinaryTree tree, Void p) visitSwitch(SwitchTree tree, Void p) Methods inherited from class org.checkerframework.common.basetype.BaseTypeVisitorcheckAccess, checkAccessAllowed, checkArguments, checkArrayInitialization, checkConditionalPostcondition, 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, getThrowUpperBoundAnnotations, getTypeFactory, isTypeCastSafe, isValidUse, isValidUse, processClassTree, reportMethodInvocabilityError, reportPurityErrors, scan, setRoot, shouldSkipUses, shouldWarnAboutIrrelevantJavaTypes, skipReceiverSubtypeCheck, testAnnotationInsertion, testJointJavacJavaParserVisitor, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotatedType, visitAnnotatedType, visitAnnotation, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitReturn, visitSwitchExpression17, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, warnAboutIrrelevantJavaTypes, warnRedundantAnnotationsMethods inherited from class org.checkerframework.framework.source.SourceVisitorvisitMethods inherited from class com.sun.source.util.TreePathScannergetCurrentPath, scanMethods inherited from class com.sun.source.util.TreeScannerreduce, scan, visitArrayAccess, visitArrayType, visitAssert, visitBindingPattern, visitBlock, visitBreak, visitCase, visitContinue, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitGuardedPattern, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitModule, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitParenthesizedPattern, visitPrimitiveType, visitProvides, visitRequires, visitSwitchExpression, visitSynchronized, visitTry, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield
- 
Constructor Details- 
FenumVisitor
 
- 
- 
Method Details- 
visitBinary- Specified by:
- visitBinaryin interface- TreeVisitor<Void,- Void> 
- Overrides:
- visitBinaryin class- TreeScanner<Void,- Void> 
 
- 
visitSwitch- Specified by:
- visitSwitchin interface- TreeVisitor<Void,- Void> 
- Overrides:
- visitSwitchin class- TreeScanner<Void,- Void> 
 
- 
checkConstructorInvocationprotected void checkConstructorInvocation(AnnotatedTypeMirror.AnnotatedDeclaredType dt, AnnotatedTypeMirror.AnnotatedExecutableType constructor, NewClassTree src) Description copied from class:BaseTypeVisitorCheck that the (explicit) annotations on a new class tree are comparable to the result type of the constructor. Issue an error if not.Issue a warning if the annotations on the constructor invocation is a subtype of the constructor result type. This is equivalent to down-casting. - Overrides:
- checkConstructorInvocationin class- BaseTypeVisitor<FenumAnnotatedTypeFactory>
 
- 
checkConstructorResultprotected void checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, ExecutableElement constructorElement) Description copied from class:BaseTypeVisitorIssue a warning if the result type of the constructor is not top. If it is a supertype of the class, then a conflicting.annos error will also be issued byBaseTypeVisitor.isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType,AnnotatedTypeMirror.AnnotatedDeclaredType,Tree).- Overrides:
- checkConstructorResultin class- BaseTypeVisitor<FenumAnnotatedTypeFactory>
- Parameters:
- constructorType- AnnotatedExecutableType for the constructor
- constructorElement- element that declares the constructor
 
- 
getExceptionParameterLowerBoundAnnotationsDescription copied from class:BaseTypeVisitorReturns a set of AnnotationMirrors that is a lower bound for exception parameters.This implementation returns top; subclasses can change this behavior. Note: by default this method is called by BaseTypeVisitor.getThrowUpperBoundAnnotations(), so that this annotation is enforced.- Overrides:
- getExceptionParameterLowerBoundAnnotationsin class- BaseTypeVisitor<FenumAnnotatedTypeFactory>
- Returns:
- set of annotation mirrors, one per hierarchy, that form a lower bound of annotations that can be written on an exception parameter
 
- 
isValidUsepublic boolean isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType declarationType, AnnotatedTypeMirror.AnnotatedDeclaredType useType, Tree tree) Description copied from class:BaseTypeVisitorTests that the qualifiers present onuseTypeare valid qualifiers, given the qualifiers on the declaration of the type,declarationType.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.In most cases, useTypesimply needs to be a subtype ofdeclarationType. If a type system makes exceptions to this rule, its implementation should override this method.This method is not called if BaseTypeValidator.shouldCheckTopLevelDeclaredOrPrimitiveType(AnnotatedTypeMirror, Tree)returns false -- by default, it is not called on the top level for locals and expressions. To enforce a type validity property everywhere, override methods such asBaseTypeValidator.visitDeclared(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType, com.sun.source.tree.Tree)rather than this method.- Overrides:
- isValidUsein class- BaseTypeVisitor<FenumAnnotatedTypeFactory>
- Parameters:
- declarationType- the type of the class (TypeElement)
- useType- the use of the class (instance type)
- tree- the tree where the type is used
- Returns:
- true if the useType is a valid use of elemType
 
 
-