Class GuiEffectVisitor
- All Implemented Interfaces:
TreeVisitor<Void,
Void>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
BaseTypeVisitor.OverrideChecker
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ArrayDeque<MethodTree>
protected final boolean
Whether or not to display debugging information.protected final ArrayDeque<Effect>
Fields inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
atypeFactory, checker, DETERMINISTIC, IMPURE, methodTree, positions, PURE, showchecks, SIDE_EFFECT_FREE, TARGET, targetValueElement, typeValidator, unusedWhenElement
Fields inherited from class org.checkerframework.framework.source.SourceVisitor
elements, root, trees, treesWithSuppressWarnings, types
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkConstructorResult
(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, ExecutableElement constructorElement) Issue a warning if the result type of the constructor is not top.protected void
checkExtendsImplements
(ClassTree classTree) If "@B class Y extends @A X {}", then enforce that @B must be a subtype of @A.protected void
checkForPolymorphicQualifiers
(ClassTree classTree) Issues an "invalid.polymorphic.qualifier" error for all polymorphic annotations written on the class declaration.protected void
checkMethodInvocability
(AnnotatedTypeMirror.AnnotatedExecutableType method, MethodInvocationTree tree) Tests whether 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>.OverrideChecker
createOverrideChecker
(Tree overriderTree, AnnotatedTypeMirror.AnnotatedExecutableType overrider, AnnotatedTypeMirror overridingType, AnnotatedTypeMirror overridingReturnType, AnnotatedTypeMirror.AnnotatedExecutableType overridden, AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType, AnnotatedTypeMirror overriddenReturnType) Create an OverrideChecker.protected GuiEffectTypeFactory
Constructs an instance of the appropriate type factory for the implemented type system.protected Set<? extends AnnotationMirror>
Returns a set of AnnotationMirrors that is a lower bound for exception parameters.boolean
isValidUse
(AnnotatedTypeMirror.AnnotatedDeclaredType declarationType, AnnotatedTypeMirror.AnnotatedDeclaredType useType, Tree tree) Tests that the qualifiers present onuseType
are valid qualifiers, given the qualifiers on the declaration of the type,declarationType
.void
processClassTree
(ClassTree classTree) Type-check classTree.visitMethod
(MethodTree tree, Void p) Checks that the method obeys override and subtype rules to all overridden methods.Performs a method invocation check.visitNewClass
(NewClassTree tree, Void p) Performs a new class invocation check.Methods inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
checkAccess, checkAccessAllowed, checkArguments, checkArrayInitialization, checkConditionalPostcondition, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkExplicitAnnotationsOnIntersectionBounds, checkFieldInvariantDeclarations, checkForPolymorphicQualifiers, checkMethodReferenceAsOverride, checkOverride, checkOverride, checkPostcondition, checkPreconditions, checkPurity, checkQualifierParameter, checkSuperConstructorCall, checkThisConstructorCall, checkThisOrSuperConstructorCall, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckStartDiagnostic, createTypeFactoryPublic, createTypeValidator, enclosingMemberSelect, enclosingStatement, getThrowUpperBoundAnnotations, getTypeFactory, isTypeCastSafe, isValidUse, isValidUse, 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, visitMemberReference, visitNewArray, visitReturn, visitSwitchExpression17, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, warnAboutIrrelevantJavaTypes, warnRedundantAnnotations
Methods inherited from class org.checkerframework.framework.source.SourceVisitor
visit
Methods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scan
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitArrayAccess, visitArrayType, visitAssert, visitBinary, 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, visitSwitch, visitSwitchExpression, visitSynchronized, visitTry, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield
-
Field Details
-
debugSpew
protected final boolean debugSpewWhether or not to display debugging information. -
effStack
-
currentMethods
-
-
Constructor Details
-
GuiEffectVisitor
-
-
Method Details
-
createTypeFactory
Description copied from class:BaseTypeVisitor
Constructs 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:
createTypeFactory
in classBaseTypeVisitor<GuiEffectTypeFactory>
- Returns:
- the appropriate type factory
-
checkMethodInvocability
protected void checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method, MethodInvocationTree tree) Description copied from class:BaseTypeVisitor
Tests whether 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:
checkMethodInvocability
in 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:BaseTypeVisitor
Create an OverrideChecker.This exists so that subclasses can subclass OverrideChecker and use their subclass instead of using OverrideChecker itself.
- Overrides:
createOverrideChecker
in 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:BaseTypeVisitor
Returns 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:
getExceptionParameterLowerBoundAnnotations
in 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:BaseTypeVisitor
Tests that the qualifiers present onuseType
are 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,
useType
simply 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:
isValidUse
in 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:
visitLambdaExpression
in interfaceTreeVisitor<Void,
Void> - Overrides:
visitLambdaExpression
in classBaseTypeVisitor<GuiEffectTypeFactory>
-
checkExtendsImplements
Description copied from class:BaseTypeVisitor
If "@B class Y extends @A X {}", then enforce that @B must be a subtype of @A.Also validate the types of the extends and implements clauses.
- Overrides:
checkExtendsImplements
in classBaseTypeVisitor<GuiEffectTypeFactory>
- Parameters:
classTree
- class tree to check
-
checkConstructorResult
protected void checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, ExecutableElement constructorElement) Description copied from class:BaseTypeVisitor
Issue 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:
checkConstructorResult
in classBaseTypeVisitor<GuiEffectTypeFactory>
- Parameters:
constructorType
- AnnotatedExecutableType for the constructorconstructorElement
- element that declares the constructor
-
checkForPolymorphicQualifiers
Description copied from class:BaseTypeVisitor
Issues an "invalid.polymorphic.qualifier" error for all polymorphic annotations written on the class declaration.- Overrides:
checkForPolymorphicQualifiers
in classBaseTypeVisitor<GuiEffectTypeFactory>
- Parameters:
classTree
- the class to check
-
visitMethodInvocation
Description copied from class:BaseTypeVisitor
Performs 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:
visitMethodInvocation
in interfaceTreeVisitor<Void,
Void> - Overrides:
visitMethodInvocation
in classBaseTypeVisitor<GuiEffectTypeFactory>
-
visitMethod
Description copied from class:BaseTypeVisitor
Checks 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:
visitMethod
in interfaceTreeVisitor<Void,
Void> - Overrides:
visitMethod
in classBaseTypeVisitor<GuiEffectTypeFactory>
-
visitNewClass
Description copied from class:BaseTypeVisitor
Performs 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:
visitNewClass
in interfaceTreeVisitor<Void,
Void> - Overrides:
visitNewClass
in classBaseTypeVisitor<GuiEffectTypeFactory>
-
processClassTree
Description copied from class:BaseTypeVisitor
Type-check classTree. Subclasses should override this method instead ofBaseTypeVisitor.visitClass(ClassTree, Void)
.- Overrides:
processClassTree
in classBaseTypeVisitor<GuiEffectTypeFactory>
- Parameters:
classTree
- class to check
-