|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.annotation.processing.AbstractProcessor
checkers.source.SourceChecker
checkers.basetype.BaseTypeChecker
checkers.igj.IGJChecker
@TypeQualifiers(value={ReadOnly.class,Mutable.class,Immutable.class,I.class,AssignsFields.class,checkers.igj.IGJBottom.class}) public class IGJChecker
A type-checker plug-in for the IGJ immutability type system that finds (and
verifies the absence of) undesired side-effect errors.
The IGJ language is a Java language extension that expresses immutability
constraints, using six annotations: ReadOnly
, Mutable
,
Immutable
, I
-- a polymorphic qualifier, Assignable
,
and AssignsFields
. The language is specified by the FSE 2007 paper.
Field Summary | |
---|---|
protected AnnotationMirror |
ASSIGNS_FIELDS
Supported Annotations for IGJ. |
protected AnnotationMirror |
BOTTOM_QUAL
Supported Annotations for IGJ. |
protected AnnotationMirror |
I
Supported Annotations for IGJ. |
protected AnnotationMirror |
IMMUTABLE
Supported Annotations for IGJ. |
protected AnnotationMirror |
MUTABLE
Supported Annotations for IGJ. |
protected AnnotationMirror |
READONLY
Supported Annotations for IGJ. |
Fields inherited from class checkers.source.SourceChecker |
---|
currentRoot, env, messager, messages, skipPattern, trees |
Fields inherited from class javax.annotation.processing.AbstractProcessor |
---|
processingEnv |
Constructor Summary | |
---|---|
IGJChecker()
|
Method Summary | |
---|---|
protected QualifierHierarchy |
createQualifierHierarchy()
Returns the type qualifier hierarchy graph to be used by this processor. |
protected TypeHierarchy |
createTypeHierarchy()
Creates the type subtyping checker using the current type qualifier hierarchy. |
void |
init(ProcessingEnvironment env)
|
boolean |
isAssignable(AnnotatedTypeMirror varType,
AnnotatedTypeMirror receiverType,
Tree varTree)
Return true if the assignment variable is an assignable field or variable, and returns false otherwise. |
boolean |
isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType elemType,
AnnotatedTypeMirror.AnnotatedDeclaredType use)
Tests that the qualifiers presents on the useType are valid qualifier, based on the declaration type, elementType. |
Methods inherited from class checkers.basetype.BaseTypeChecker |
---|
createFactory, createSourceVisitor, createSupportedTypeQualifiers, getQualifierHierarchy, getSupportedLintOptions, getSupportedTypeQualifiers, isSubtype |
Methods inherited from class checkers.source.SourceChecker |
---|
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 |
---|
protected AnnotationMirror READONLY
protected AnnotationMirror MUTABLE
protected AnnotationMirror IMMUTABLE
protected AnnotationMirror I
protected AnnotationMirror ASSIGNS_FIELDS
protected AnnotationMirror BOTTOM_QUAL
Constructor Detail |
---|
public IGJChecker()
Method Detail |
---|
public void init(ProcessingEnvironment env)
SourceChecker
init
in interface Processor
init
in class BaseTypeChecker
AbstractProcessor.init(javax.annotation.processing.ProcessingEnvironment)
public boolean isAssignable(AnnotatedTypeMirror varType, AnnotatedTypeMirror receiverType, Tree varTree)
Assignable
3. accessed through a mutable reference
4. reassigned with an AssignsFields
method and owned by 'this'
isAssignable
in class BaseTypeChecker
varType
- the annotated variable typevarTree
- tree used to access the variable
public boolean isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType elemType, AnnotatedTypeMirror.AnnotatedDeclaredType use)
BaseTypeChecker
For instance, in the IGJ type system, a @Mutable
is invalid
qualifier to String
, as String
is declared as
@Immutable String
.
In most cases, useType
simply needs to be a subtype of
elemType
, but there are exceptions. In IGJ, a variable may be
declared @ReadOnly String
, even though String
is
@Immutable String
; ReadOnly
is not a subtype of
Immutable
.
isValidUse
in class BaseTypeChecker
elemType
- the type of the class (TypeElement)use
- the use of the class (instance type)
protected QualifierHierarchy createQualifierHierarchy()
BaseTypeChecker
BaseTypeChecker.getSupportedTypeQualifiers()
using the
meta-annotations found in them. The current implementation returns an
instance of DAGQualifierHierarchy
.
Subclasses may override this method to express any relationships that
cannot be inferred using meta-annotations (e.g. due to lack of
meta-annotations).
createQualifierHierarchy
in class BaseTypeChecker
protected TypeHierarchy createTypeHierarchy()
BaseTypeChecker
createTypeHierarchy
in class BaseTypeChecker
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |