Class KeyForVisitor.KeyForOverrideChecker
java.lang.Object
BaseTypeVisitor<KeyForAnnotatedTypeFactory>.org.checkerframework.common.basetype.BaseTypeVisitor.OverrideChecker
org.checkerframework.checker.nullness.KeyForVisitor.KeyForOverrideChecker
- Enclosing class:
KeyForVisitor
protected class KeyForVisitor.KeyForOverrideChecker
extends BaseTypeVisitor<KeyForAnnotatedTypeFactory>.OverrideChecker
An override checker that does not check the lower bounds of an overriding method's type
parameters.
The default for lower bounds is @UnknownKeyFor, except in java.* packages,
where it is @KeyForBottom. Checking lower bounds would therefore require an annotation
on the type parameter of every method that overrides a generic JDK method, such as
Collection.toArray(T[]).
- See the Checker Framework Manual:
- Default for lower bounds
-
Field Summary
Fields inherited from class org.checkerframework.common.basetype.BaseTypeVisitor.OverrideChecker
isMethodReference, overridden, overriddenReturnType, overriddenType, overrider, overriderReturnType, overriderTree, overriderType, typeVarMapping -
Constructor Summary
ConstructorsConstructorDescriptionKeyForOverrideChecker(Tree overriderTree, AnnotatedTypeMirror.AnnotatedExecutableType overrider, AnnotatedTypeMirror overriderType, AnnotatedTypeMirror overriderReturnType, AnnotatedTypeMirror.AnnotatedExecutableType overridden, AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType, AnnotatedTypeMirror overriddenReturnType) Create a KeyForOverrideChecker. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckTypeParameterLowerBound(int index) Issue an error if the lower bound of the overriding method's type parameter at the given index is not a subtype of the lower bound of the overridden method's type parameter.Methods inherited from class org.checkerframework.common.basetype.BaseTypeVisitor.OverrideChecker
adaptToOverridden, checkOverride, checkReceiverOverride, checkTypeParameterBounds, checkTypeParameterUpperBound
-
Constructor Details
-
KeyForOverrideChecker
public KeyForOverrideChecker(Tree overriderTree, AnnotatedTypeMirror.AnnotatedExecutableType overrider, AnnotatedTypeMirror overriderType, AnnotatedTypeMirror overriderReturnType, AnnotatedTypeMirror.AnnotatedExecutableType overridden, AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType, AnnotatedTypeMirror overriddenReturnType) Create a KeyForOverrideChecker.- Parameters:
overriderTree- the AST node of the overriding method or method referenceoverrider- the type of the overriding methodoverriderType- the type enclosing the overrider method, usually an AnnotatedDeclaredType; for Method References may be something elseoverriderReturnType- 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
-
-
Method Details
-
checkTypeParameterLowerBound
protected boolean checkTypeParameterLowerBound(int index) Description copied from class:BaseTypeVisitor.OverrideCheckerIssue an error if the lower bound of the overriding method's type parameter at the given index is not a subtype of the lower bound of the overridden method's type parameter.- Overrides:
checkTypeParameterLowerBoundin classBaseTypeVisitor<KeyForAnnotatedTypeFactory>.OverrideChecker- Parameters:
index- the index of the type parameter- Returns:
- true if the lower bound is correct
-