|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcheckers.types.AnnotatedTypeFactory
checkers.igj.IGJAnnotatedTypeFactory
public class IGJAnnotatedTypeFactory
Generates AnnotatedTypeMirror
instances accounting for the
properties of the IGJ type system. It add implicit and default IGJ
annotations, only if the user does not annotate the type explicitly.
This factory will add the Immutable
annotation to a type if the
input is
Immutable
, orReadOnly
annotation to a type if the input is
Mutable
annotation to a type if the input is
a use of a mutable type.
As an implementation detail, it adds a special annotation, IGJPlaceHolder,
Furthermore, it resolves I
annotation to the proper annotation
according to its specification.
Field Summary |
---|
Fields inherited from class checkers.types.AnnotatedTypeFactory |
---|
annoRelations, annotations, atypes, checker, elements, env, root, trees, types, visitorState |
Constructor Summary | |
---|---|
IGJAnnotatedTypeFactory(IGJChecker checker,
CompilationUnitTree root)
Constructor for IGJAnnotatedTypeFactory object. |
Method Summary | |
---|---|
protected void |
annotateImplicit(Element element,
AnnotatedTypeMirror type)
Adds implicit annotations to a type obtained from a Element . |
protected void |
annotateImplicit(Tree tree,
AnnotatedTypeMirror type)
Adds implicit annotations to a type obtained from a Tree . |
protected void |
annotateInheritedFromClass(AnnotatedTypeMirror type)
Override the default behavior of implicitly adding annotations on the class type to the declared types within the passed type. |
AnnotatedTypeMirror.AnnotatedDeclaredType |
getSelfType(Tree tree)
Returns the type of field this , for the scope of this tree. |
AnnotatedTypeMirror.AnnotatedExecutableType |
methodFromUse(MethodInvocationTree tree)
Resolves @I in the type of the method type base on the method
invocation tree parameters. |
void |
postAsMemberOf(AnnotatedTypeMirror elementType,
AnnotatedTypeMirror owner,
Element element)
Resolve the instances of @I in the elementType based
on owner , according to is specification. |
protected void |
postDirectSuperTypes(AnnotatedTypeMirror type,
List<? extends AnnotatedTypeMirror> supertypes)
Replace all instances of @I in the super types with the
immutability of the current type |
Collection<AnnotationMirror> |
unify(Collection<AnnotationMirror> c1,
Collection<AnnotationMirror> c2)
Returns the type qualifiers to be least upper bound for c1 and c2 qualifiers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IGJAnnotatedTypeFactory(IGJChecker checker, CompilationUnitTree root)
checker
- the checker to which this factory belongsroot
- the compilation unit the annotation processor is
processing currentlyMethod Detail |
---|
protected void annotateImplicit(Tree tree, AnnotatedTypeMirror type)
AnnotatedTypeFactory
Tree
. By
default, this method does nothing. Subclasses should use this method to
implement implicit annotations specific to their type systems.
annotateImplicit
in class AnnotatedTypeFactory
tree
- an AST nodetype
- the type obtained from tree
protected void annotateImplicit(Element element, AnnotatedTypeMirror type)
AnnotatedTypeFactory
Element
. By
default, this method does nothing. Subclasses should use this method to
implement implicit annotations specific to their type systems.
annotateImplicit
in class AnnotatedTypeFactory
element
- an elementtype
- the type obtained from elt
protected void postDirectSuperTypes(AnnotatedTypeMirror type, List<? extends AnnotatedTypeMirror> supertypes)
@I
in the super types with the
immutability of the current type
postDirectSuperTypes
in class AnnotatedTypeFactory
type
- the type whose supertypes are requestedsupertypes
- the supertypes of typepublic void postAsMemberOf(AnnotatedTypeMirror elementType, AnnotatedTypeMirror owner, Element element)
@I
in the elementType
based
on owner
, according to is specification.
postAsMemberOf
in class AnnotatedTypeFactory
elementType
- the annotated type of the elementowner
- the annotated type of the receiver of the accessing treeelement
- the element of the field or methodprotected void annotateInheritedFromClass(AnnotatedTypeMirror type)
annotateInheritedFromClass
in class AnnotatedTypeFactory
type
- the type for which class annotations will be inherited if
there are no annotations already presentpublic AnnotatedTypeMirror.AnnotatedDeclaredType getSelfType(Tree tree)
this
, for the scope of this tree.
In IGJ, the self type is the method receiver in this scope.
getSelfType
in class AnnotatedTypeFactory
public Collection<AnnotationMirror> unify(Collection<AnnotationMirror> c1, Collection<AnnotationMirror> c2)
AnnotatedTypeFactory
unify
in class AnnotatedTypeFactory
c1
- type qualifiers for the first typec2
- tyep qualifiers for the second type
public AnnotatedTypeMirror.AnnotatedExecutableType methodFromUse(MethodInvocationTree tree)
@I
in the type of the method type base on the method
invocation tree parameters. Any unresolved @I
s is resolved to a
place holder type.
It resolves @I
annotation in the following way:
AnnotatedTypes.asMemberOf(AnnotatedTypeMirror, Element)
methodFromUse
in class AnnotatedTypeFactory
tree
- the method invocation tree
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |