public class GuiEffectVisitor extends BaseTypeVisitor<GuiEffectTypeFactory>
| Modifier and Type | Field and Description |
|---|---|
protected Stack<MethodTree> |
currentMethods |
protected boolean |
debugSpew |
protected Stack<Effect> |
effStack |
atypeFactory, checker, contractsUtils, positions, typeValidator, visitorStateelements, root, trees, types| Constructor and Description |
|---|
GuiEffectVisitor(BaseTypeChecker checker) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
MethodInvocationTree node)
Tests whether the method can be invoked using the receiver of the 'node'
method invocation, and issues a "method.invocation.invalid" if the
invocation is invalid.
|
protected boolean |
checkOverride(MethodTree overriderTree,
AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType,
AnnotatedTypeMirror.AnnotatedExecutableType overridden,
AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType,
Void p)
Type checks that a method may override another method.
|
protected GuiEffectTypeFactory |
createTypeFactory()
Constructs an instance of the appropriate type factory for the
implemented type system.
|
protected Set<? extends AnnotationMirror> |
getExceptionParameterLowerBoundAnnotations()
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 on the useType are valid qualifiers,
given the qualifiers on the declaration of the type, declarationType.
|
Void |
visitClass(ClassTree node,
Void p) |
Void |
visitMemberSelect(MemberSelectTree node,
Void p) |
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)
Performs a method invocation check.
|
checkAccess, checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkConditionalPostconditions, checkConditionalPostconditionsConsistency, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkFlowExprParameters, checkForAnnotatedJdk, checkMethodReferenceAsOverride, checkPostconditions, checkPostconditionsConsistency, checkPreconditions, checkPreconditions, checkPreconditionsConsistency, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, createTypeValidator, enclosingMemberSelect, enclosingStatement, getThrowUpperBoundAnnotations, getTypeFactory, isAccessAllowed, isAssignable, isValidUse, isValidUse, isVectorCopyInto, reportPurityErrors, scan, setRoot, shouldSkipUses, skipContractCheck, skipReceiverSubtypeCheck, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotation, visitArrayAccess, visitAssignment, visitCatch, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariablevisitgetCurrentPath, scanreduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBinary, visitBlock, visitBreak, visitCase, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitTry, visitUnionType, visitWhileLoop, visitWildcardprotected final boolean debugSpew
protected final Stack<MethodTree> currentMethods
public GuiEffectVisitor(BaseTypeChecker checker)
protected GuiEffectTypeFactory createTypeFactory()
BaseTypeVisitorBaseAnnotatedTypeFactory. 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.createTypeFactory in class BaseTypeVisitor<GuiEffectTypeFactory>protected void checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method, MethodInvocationTree node)
BaseTypeVisitorcheckMethodInvocability in class BaseTypeVisitor<GuiEffectTypeFactory>method - the type of the invoked methodnode - the method invocation nodeprotected boolean checkOverride(MethodTree overriderTree, AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType, AnnotatedTypeMirror.AnnotatedExecutableType overridden, AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType, Void p)
BaseTypeVisitorcheckOverride in class BaseTypeVisitor<GuiEffectTypeFactory>overriderTree - Declaration tree of overriding methodenclosingType - Type of overriding classoverridden - Type of overridden methodoverriddenType - Type of overridden classprotected Set<? extends AnnotationMirror> getExceptionParameterLowerBoundAnnotations()
BaseTypeVisitorgetExceptionParameterLowerBoundAnnotations in class BaseTypeVisitor<GuiEffectTypeFactory>public boolean isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType declarationType, AnnotatedTypeMirror.AnnotatedDeclaredType useType, Tree tree)
BaseTypeVisitor
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.
For instance, in the IGJ type system, a @Mutable is an invalid
qualifier for String, as String is declared as
@Immutable String.
In most cases, useType simply needs to be a subtype of
declarationType, but there are exceptions. In IGJ, a variable may be
declared @ReadOnly String, even though String is
@Immutable String; ReadOnly is not a subtype of
Immutable.
isValidUse in class BaseTypeVisitor<GuiEffectTypeFactory>declarationType - the type of the class (TypeElement)useType - the use of the class (instance type)tree - the tree where the type is usedpublic Void visitMethodInvocation(MethodInvocationTree node, Void p)
BaseTypeVisitorvisitMethodInvocation in interface TreeVisitor<Void,Void>visitMethodInvocation in class BaseTypeVisitor<GuiEffectTypeFactory>public Void visitMethod(MethodTree node, Void p)
BaseTypeVisitorvisitMethod in interface TreeVisitor<Void,Void>visitMethod in class BaseTypeVisitor<GuiEffectTypeFactory>public Void visitMemberSelect(MemberSelectTree node, Void p)
visitMemberSelect in interface TreeVisitor<Void,Void>visitMemberSelect in class TreeScanner<Void,Void>public Void visitClass(ClassTree node, Void p)
visitClass in interface TreeVisitor<Void,Void>visitClass in class BaseTypeVisitor<GuiEffectTypeFactory>