checkers.javari
Class JavariChecker
java.lang.Object
javax.annotation.processing.AbstractProcessor
checkers.source.SourceChecker
checkers.basetype.BaseTypeChecker
checkers.javari.JavariChecker
- All Implemented Interfaces:
- Processor
@TypeQualifiers(value={ReadOnly.class,checkers.javari.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, process, report, shouldSkip |
| 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(javax.annotation.processing.ProcessingEnvironment)
createQualifierHierarchy
protected QualifierHierarchy createQualifierHierarchy()
- Description copied from class:
BaseTypeChecker
- Returns the type qualifier hierarchy graph to be used by this processor.
The implementation builds the type qualifier hierarchy for the
BaseTypeChecker.getSupportedTypeQualifiers() using the
meta-annotations found in them. The current implementation returns an
instance of GraphQualifierHierarchy.
Subclasses may override this method to express any relationships that
cannot be inferred using meta-annotations (e.g. due to lack of
meta-annotations).
- Overrides:
createQualifierHierarchy in class BaseTypeChecker
- Returns:
- an annotation relation tree representing the supported qualifiers
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 a type is primitive or if a type is subtype of another.
- 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