checkers.javari
Class JavariChecker
java.lang.Object
javax.annotation.processing.AbstractProcessor
com.sun.source.util.AbstractTypeProcessor
checkers.source.SourceChecker
checkers.basetype.BaseTypeChecker
checkers.javari.JavariChecker
- All Implemented Interfaces:
- Processor
@TypeQualifiers(value={ReadOnly.class,ThisMutable.class,Mutable.class,PolyRead.class,QReadOnly.class})
public class JavariChecker
- extends BaseTypeChecker
An annotation processor that checks a program's use of the Javari
type annotations (\@ReadOnly
, \@Mutable
, \@Assignable
, \@PolyRead
and \@QReadOnly
).
- See the checkers manual:
- Javari Checker
Methods inherited from class checkers.source.SourceChecker |
getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, message, report, shouldSkip, typeProcess |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
READONLY
protected AnnotationMirror READONLY
THISMUTABLE
protected AnnotationMirror THISMUTABLE
MUTABLE
protected AnnotationMirror MUTABLE
POLYREAD
protected AnnotationMirror POLYREAD
QREADONLY
protected AnnotationMirror QREADONLY
ASSIGNABLE
protected AnnotationMirror ASSIGNABLE
JavariChecker
public JavariChecker()
init
public void init(ProcessingEnvironment processingEnv)
- Initializes the checker: calls init method on super class,
creates a local AnnotationFactory based on the processing
environment, and uses it to create the protected
AnnotationMirrors used through this checker.
- Specified by:
init
in interface Processor
- Overrides:
init
in class BaseTypeChecker
- Parameters:
processingEnv
- the processing environment to use in the local AnnotationFactory- See Also:
AbstractProcessor.init(ProcessingEnvironment)
createTypeHierarchy
protected TypeHierarchy createTypeHierarchy()
- Implements the
@QReadOnly
behavior on generic types,
creating a new TypeHierarchy
class that allows a
comparison of type arguments to succeed if the left hand side
is annotated with @QReadOnly
or if the regular
comparison succeeds.
- Overrides:
createTypeHierarchy
in class BaseTypeChecker
- Returns:
- the type relations class to check type subtyping
isSubtype
public boolean isSubtype(AnnotatedTypeMirror sub,
AnnotatedTypeMirror sup)
- Checks if one the parameters is primitive, or if a type is
subtype of another. Primitive types always pass to avoid issues
with boxing.
- Overrides:
isSubtype
in class BaseTypeChecker
- Parameters:
sub
- the child typesup
- the parent type
- Returns:
- true iff
sub
is a subtype of sup
isValidUse
public boolean isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType elemType,
AnnotatedTypeMirror.AnnotatedDeclaredType useType)
- Always true; no type validity checking is made by the BaseTypeVisitor.
- Overrides:
isValidUse
in class BaseTypeChecker
- Parameters:
elemType
- the type of the class (TypeElement)useType
- the use of the class (instance type)
- Returns:
- if the useType is a valid use of elemType
- See Also:
BaseTypeVisitor