Class GuiEffectVisitor
- All Implemented Interfaces:
TreeVisitor<Void,Void>
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
BaseTypeVisitor.OverrideChecker -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ArrayDeque<MethodTree> protected final booleanIf true, display debugging information.protected final ArrayDeque<Effect> Fields inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
assumePureGetters, atypeFactory, checker, DETERMINISTIC, IMPURE, methodTree, positions, PURE, qualHierarchy, showchecks, SIDE_EFFECT_FREE, slowTypecheckingSeconds, slowTypecheckingTree, TARGET, targetValueElement, typeHierarchy, typeValidator, unusedWhenElement, warnRedundantAnnotationsFields inherited from class org.checkerframework.framework.source.SourceVisitor
elements, root, trees, treesWithSuppressWarnings, types -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, ExecutableElement constructorElement) Issue a warning if the result type of the constructor declaration is not top.protected voidcheckExtendsAndImplements(ClassTree classTree) In@A class X extends @B Y implements @C Z {}, enforce that@Amust be a subtype of@Band@C.protected voidcheckMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method, MethodInvocationTree tree) Returns true if the method can be invoked using the receiver of the 'tree' method invocation, and issues a "method.invocation" if the invocation is invalid.protected BaseTypeVisitor<GuiEffectTypeFactory>.OverrideCheckercreateOverrideChecker(Tree overriderTree, AnnotatedTypeMirror.AnnotatedExecutableType overrider, AnnotatedTypeMirror overridingType, AnnotatedTypeMirror overridingReturnType, AnnotatedTypeMirror.AnnotatedExecutableType overridden, AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType, AnnotatedTypeMirror overriddenReturnType) Create an OverrideChecker.protected GuiEffectTypeFactoryConstructs an instance of the appropriate type factory for the implemented type system.protected AnnotationMirrorSetReturns 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.voidprocessClassTree(ClassTree classTree) Type-check classTree.voidprocessMethodTree(String className, MethodTree tree) Type-check methodTree.Performs a method invocation check.visitNewClass(NewClassTree tree, Void p) Performs a new class invocation check.protected voidwarnInvalidPolymorphicQualifier(ClassTree classTree) Issues an "invalid.polymorphic.qualifier" error for all polymorphic annotations written on the class declaration.Methods inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
checkAccess, checkAccessAllowed, checkArguments, checkArrayInitialization, checkConditionalPostcondition, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkExplicitAnnotationsOnIntersectionBounds, checkExtendsOrImplements, checkFieldInvariantDeclarations, checkMethodReferenceAsOverride, checkOverride, checkOverride, checkPostcondition, checkPreconditions, checkPurityAnnotations, checkQualifierParameter, checkSuperConstructorCall, checkThisConstructorCall, checkThisOrSuperConstructorCall, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckStartDiagnostic, contractExpressionAndType, createTypeFactoryPublic, createTypeValidator, enclosingMemberSelect, enclosingStatement, getThrowUpperBoundAnnotations, getTypeFactory, isTypeCastSafe, isValidUse, isValidUse, reportMethodInvocabilityError, reportPurityErrors, scan, setRoot, shouldPerformContractInference, shouldSkipUses, shouldWarnAboutIrrelevantJavaTypes, skipReceiverSubtypeCheck, testAnnotationInsertion, testJointJavacJavaParserVisitor, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotatedType, visitAnnotatedType, visitAnnotation, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitMemberReference, visitMethod, visitNewArray, visitReturn, visitSwitchExpression17, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, warnAboutIrrelevantJavaTypes, warnInvalidPolymorphicQualifier, warnRedundantAnnotationsMethods inherited from class org.checkerframework.framework.source.SourceVisitor
visitMethods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scanMethods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnyPattern, visitArrayAccess, visitArrayType, visitAssert, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitConstantCaseLabel, visitContinue, visitDeconstructionPattern, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitModule, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitStringTemplate, visitSwitch, visitSwitchExpression, visitSynchronized, visitTry, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield
-
Field Details
-
debugSpew
protected final boolean debugSpewIf true, display debugging information. -
effStack
-
currentMethods
-
-
Constructor Details
-
GuiEffectVisitor
-
-
Method Details
-
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<GuiEffectTypeFactory>- Returns:
- the appropriate type factory
-
checkMethodInvocability
protected void checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method, MethodInvocationTree tree) Description copied from class:BaseTypeVisitorReturns true if the method can be invoked using the receiver of the 'tree' method invocation, and issues a "method.invocation" 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<GuiEffectTypeFactory>- Parameters:
method- the type of the invoked methodtree- the method invocation tree
-
createOverrideChecker
protected BaseTypeVisitor<GuiEffectTypeFactory>.OverrideChecker createOverrideChecker(Tree overriderTree, AnnotatedTypeMirror.AnnotatedExecutableType overrider, AnnotatedTypeMirror overridingType, AnnotatedTypeMirror overridingReturnType, AnnotatedTypeMirror.AnnotatedExecutableType overridden, AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType, AnnotatedTypeMirror overriddenReturnType) Description copied from class:BaseTypeVisitorCreate an OverrideChecker.This exists so that subclasses can subclass OverrideChecker and use their subclass instead of using OverrideChecker itself.
- Overrides:
createOverrideCheckerin classBaseTypeVisitor<GuiEffectTypeFactory>- Parameters:
overriderTree- the AST node of the overriding method or method referenceoverrider- the type of the overriding methodoverridingType- the type enclosing the overrider method, usually an AnnotatedDeclaredType; for Method References may be something elseoverridingReturnType- the return type of the overriding methodoverridden- the type of the overridden methodoverriddenType- the declared type enclosing the overridden methodoverriddenReturnType- the return type of the overridden method- Returns:
- an OverrideChecker
-
getExceptionParameterLowerBoundAnnotations
Description 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 classBaseTypeVisitor<GuiEffectTypeFactory>- Returns:
- set of annotation mirrors, one per hierarchy, that form a lower bound of annotations that can be written on an exception parameter
-
isValidUse
public 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 classBaseTypeVisitor<GuiEffectTypeFactory>- 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
-
visitLambdaExpression
- Specified by:
visitLambdaExpressionin interfaceTreeVisitor<Void,Void> - Overrides:
visitLambdaExpressionin classBaseTypeVisitor<GuiEffectTypeFactory>
-
checkExtendsAndImplements
Description copied from class:BaseTypeVisitorIn@A class X extends @B Y implements @C Z {}, enforce that@Amust be a subtype of@Band@C.Also validate the types of the extends and implements clauses.
- Overrides:
checkExtendsAndImplementsin classBaseTypeVisitor<GuiEffectTypeFactory>- Parameters:
classTree- class tree to check
-
checkConstructorResult
protected void checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, 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 conflicting.annos error will also be issued byBaseTypeVisitor.isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType,AnnotatedTypeMirror.AnnotatedDeclaredType,Tree).- Overrides:
checkConstructorResultin classBaseTypeVisitor<GuiEffectTypeFactory>- Parameters:
constructorType- the AnnotatedExecutableType for the constructorconstructorElement- the element that declares the constructor
-
warnInvalidPolymorphicQualifier
Description copied from class:BaseTypeVisitorIssues an "invalid.polymorphic.qualifier" error for all polymorphic annotations written on the class declaration.- Overrides:
warnInvalidPolymorphicQualifierin classBaseTypeVisitor<GuiEffectTypeFactory>- Parameters:
classTree- the class to check
-
visitMethodInvocation
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 interfaceTreeVisitor<Void,Void> - Overrides:
visitMethodInvocationin classBaseTypeVisitor<GuiEffectTypeFactory>
-
processMethodTree
Description copied from class:BaseTypeVisitorType-check methodTree. Subclasses should override this method instead ofBaseTypeVisitor.visitMethod(MethodTree, Void).- Overrides:
processMethodTreein classBaseTypeVisitor<GuiEffectTypeFactory>- Parameters:
className- the class that contains the method, for diagnostics onlytree- the method to type-check
-
visitNewClass
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 interfaceTreeVisitor<Void,Void> - Overrides:
visitNewClassin classBaseTypeVisitor<GuiEffectTypeFactory>
-
processClassTree
Description copied from class:BaseTypeVisitorType-check classTree. Subclasses should override this method instead ofBaseTypeVisitor.visitClass(ClassTree, Void).- Overrides:
processClassTreein classBaseTypeVisitor<GuiEffectTypeFactory>- Parameters:
classTree- class to check
-