|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcheckers.types.AnnotatedTypeFactory
checkers.javari.JavariAnnotatedTypeFactory
public class JavariAnnotatedTypeFactory
Generates a AnnotatedTypeMirror with Javari annotations from a Tree or a Element parameter.
Implicit annotations are added as follows:
@Mutable annotation.
@ReadOnly,
@Mutable or @PolyRead), according to the
qualified type of {@code this}.
| Field Summary |
|---|
| Fields inherited from class checkers.types.AnnotatedTypeFactory |
|---|
annotations, atypes, checker, elements, env, qualHierarchy, root, trees, types, visitorState |
| Constructor Summary | |
|---|---|
JavariAnnotatedTypeFactory(JavariChecker checker,
CompilationUnitTree root)
Creates a new JavariAnnotatedTypeFactory that operates on a
particular AST. |
|
| Method Summary | |
|---|---|
protected void |
annotateImplicit(Element element,
AnnotatedTypeMirror type)
Adds annotations to qualified types according to their provided element, as follows: Qualified class types without annotations corresponding to class or interface elements receive the @Mutable
annotation. |
protected void |
annotateImplicit(Tree tree,
AnnotatedTypeMirror type)
Adds implicit annotations to a qualified type, based on its tree, as follows: Resolves qualified types from MemberSelectTree, inheritting from the expression to the identifier if the identifier is @ThisMutable. |
protected void |
annotateInheritedFromClass(AnnotatedTypeMirror type)
Does nothing. |
AnnotatedTypeMirror.AnnotatedExecutableType |
constructorFromUse(NewClassTree tree)
Determines the type of the constructed object based on the parameters passed to the constructor. |
boolean |
hasImmutabilityAnnotation(AnnotatedTypeMirror type)
|
AnnotatedTypeMirror.AnnotatedExecutableType |
methodFromUse(MethodInvocationTree tree)
Determines the type of the invoked method based on the passed method invocation tree. |
void |
postAsMemberOf(AnnotatedTypeMirror type,
AnnotatedTypeMirror owner,
Element element)
We modify this callback method to replace @ThisMutable
implicit annotations with the qualified supertype annotation,
if the owner doesn't have a @ReadOnly annotation. |
Collection<AnnotationMirror> |
unify(Collection<AnnotationMirror> c1,
Collection<AnnotationMirror> c2)
Returns a singleton collection with the most restrictive immutability annotation that is a supertype of the annotations on both collections. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JavariAnnotatedTypeFactory(JavariChecker checker,
CompilationUnitTree root)
JavariAnnotatedTypeFactory that operates on a
particular AST.
checker - the checker to which this factory belongsroot - the AST on which this type factory operates| Method Detail |
|---|
public boolean hasImmutabilityAnnotation(AnnotatedTypeMirror type)
type - an annotated type mirror
protected void annotateImplicit(Tree tree,
AnnotatedTypeMirror type)
@ThisMutable.
@Mutable annotation.
@ReadOnly,
@Mutable or @PolyRead), according to the
qualified type of {@code this}.
annotateImplicit in class AnnotatedTypeFactorytree - an AST nodetype - the type obtained from tree
protected void annotateImplicit(Element element,
AnnotatedTypeMirror type)
@Mutable
annotation.
@ReadOnly or
@ThisMutable, according to the supertype.
annotateImplicit in class AnnotatedTypeFactoryelement - an elementtype - the type obtained from eltprotected void annotateInheritedFromClass(AnnotatedTypeMirror type)
annotateInheritedFromClass in class AnnotatedTypeFactorytype - the type for which class annotations will be inherited if
there are no annotations already present
public Collection<AnnotationMirror> unify(Collection<AnnotationMirror> c1,
Collection<AnnotationMirror> c2)
unify in class AnnotatedTypeFactoryc1 - type qualifiers for the first typec2 - tyep qualifiers for the second type
public AnnotatedTypeMirror.AnnotatedExecutableType constructorFromUse(NewClassTree tree)
@PolyRead receiver values are resolved by looking at
the mutability of any parameters marked as {@code
constructorFromUse in class AnnotatedTypeFactorytree - the new class tree
public AnnotatedTypeMirror.AnnotatedExecutableType methodFromUse(MethodInvocationTree tree)
methodFromUse in class AnnotatedTypeFactorytree - the method invocation tree
public void postAsMemberOf(AnnotatedTypeMirror type,
AnnotatedTypeMirror owner,
Element element)
@ThisMutable
implicit annotations with the qualified supertype annotation,
if the owner doesn't have a @ReadOnly annotation.
Note on the given example that, if @ThisMutable tmObject
were resolved as @ReadOnly tmObject, the code snippet
would be legal. Such a class could then be created to obtain {@code
postAsMemberOf in class AnnotatedTypeFactorytype - the annotated type of the elementowner - the annotated type of the receiver of the accessing treeelement - the element of the field or method
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||