public class TypecheckVisitorAdapter<Q> extends BaseTypeVisitor<GenericAnnotatedTypeFactory<?,?,?,?>>
QualifiedTypeMirror
s instead of
AnnotatedTypeMirror
s.
Extending classes will use the QualifiedTypeFactory provided by context
.Modifier and Type | Field and Description |
---|---|
protected QualifierContext<Q> |
context |
atypeFactory, checker, contractsUtils, positions, typeValidator, visitorState
elements, root, trees, types
Constructor and Description |
---|
TypecheckVisitorAdapter(CheckerAdapter<Q> checker) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkExceptionParameter(CatchTree node)
Issue error if the exception parameter is not a supertype of the
annotation specified by
BaseTypeVisitor.getExceptionParameterLowerBoundAnnotations() ,
which is top by default. |
protected org.checkerframework.qualframework.base.QualifiedTypeFactoryAdapter<Q> |
createTypeFactory()
Constructs an instance of the appropriate type factory for the
implemented type system.
|
protected Q |
getExceptionParameterLowerBoundQualifier() |
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.
|
checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkConditionalPostconditions, checkConditionalPostconditionsConsistency, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkFlowExprParameters, checkForAnnotatedJdk, checkMethodInvocability, checkMethodReferenceAsOverride, checkOverride, checkPostconditions, checkPostconditionsConsistency, checkPreconditions, checkPreconditions, checkPreconditionsConsistency, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, createTypeValidator, enclosingMemberSelect, enclosingStatement, getExceptionParameterLowerBoundAnnotations, getThrowUpperBoundAnnotations, getTypeFactory, isAccessAllowed, isAssignable, isValidUse, isValidUse, isVectorCopyInto, parseExpressionString, reportPurityErrors, scan, setRoot, shouldSkipUses, skipReceiverSubtypeCheck, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotation, visitArrayAccess, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable
visit
getCurrentPath, scan
reduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBinary, visitBlock, visitBreak, visitCase, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitTry, visitUnionType, visitWhileLoop, visitWildcard
protected final QualifierContext<Q> context
public TypecheckVisitorAdapter(CheckerAdapter<Q> checker)
protected org.checkerframework.qualframework.base.QualifiedTypeFactoryAdapter<Q> createTypeFactory()
BaseTypeVisitor
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.createTypeFactory
in class BaseTypeVisitor<GenericAnnotatedTypeFactory<?,?,?,?>>
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.
In most cases, useType
simply needs to be a subtype of
declarationType
, but there are exceptions.
isValidUse
in class BaseTypeVisitor<GenericAnnotatedTypeFactory<?,?,?,?>>
declarationType
- the type of the class (TypeElement)useType
- the use of the class (instance type)tree
- the tree where the type is usedprotected void checkExceptionParameter(CatchTree node)
BaseTypeVisitor
BaseTypeVisitor.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()
.
checkExceptionParameter
in class BaseTypeVisitor<GenericAnnotatedTypeFactory<?,?,?,?>>
node
- CatchTree to checkprotected Q getExceptionParameterLowerBoundQualifier()