checkers.javari
Class JavariChecker

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by checkers.source.SourceChecker
          extended by checkers.basetype.BaseTypeChecker
              extended by 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

Field Summary
protected  AnnotationMirror ASSIGNABLE
           
protected  AnnotationMirror MUTABLE
           
protected  AnnotationMirror POLYREAD
           
protected  AnnotationMirror QREADONLY
           
protected  AnnotationMirror READONLY
           
protected  AnnotationMirror THISMUTABLE
           
 
Fields inherited from class checkers.source.SourceChecker
currentRoot, env, messager, messages, skipPattern, trees
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
JavariChecker()
           
 
Method Summary
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.
 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.
 boolean isSubtype(AnnotatedTypeMirror sub, AnnotatedTypeMirror sup)
          Checks if one the parameters is primitive, or if a type is subtype of another.
 boolean isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType elemType, AnnotatedTypeMirror.AnnotatedDeclaredType useType)
          Always true; no type validity checking is made by the BaseTypeVisitor.
 
Methods inherited from class checkers.basetype.BaseTypeChecker
createFactory, createQualifierHierarchy, createSourceVisitor, createSupportedTypeQualifiers, getQualifierHierarchy, getSupportedLintOptions, getSupportedTypeQualifiers, isAssignable
 
Methods inherited from class checkers.source.SourceChecker
attribute, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, message, process, report, shouldSkip
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READONLY

protected AnnotationMirror READONLY

THISMUTABLE

protected AnnotationMirror THISMUTABLE

MUTABLE

protected AnnotationMirror MUTABLE

POLYREAD

protected AnnotationMirror POLYREAD

QREADONLY

protected AnnotationMirror QREADONLY

ASSIGNABLE

protected AnnotationMirror ASSIGNABLE
Constructor Detail

JavariChecker

public JavariChecker()
Method Detail

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 type
sup - 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