public class QualifierPolymorphism extends Object
annotate(MethodInvocationTree, AnnotatedTypeMirror.AnnotatedExecutableType)
to the AnnotatedTypeFactory.addComputedTypeAnnotations(Tree, AnnotatedTypeMirror) and
AnnotatedTypeFactory.addComputedTypeAnnotations(Tree, AnnotatedTypeMirror) methods.
This implementation currently only supports polymorphism for method invocations, for which the return type depends on the unification of the parameter/receiver types.
PolymorphicQualifier| Modifier and Type | Field and Description |
|---|---|
protected Map<AnnotationMirror,AnnotationMirror> |
polyQuals
The polymorphic qualifiers: mapping from the top of a qualifier hierarchy to the polymorphic
qualifier of that hierarchy.
|
protected QualifierHierarchy |
qualhierarchy
The qualifier hierarchy to use.
|
protected Set<? extends AnnotationMirror> |
topQuals
The qualifiers at the top of the qualifier hierarchy.
|
| Constructor and Description |
|---|
QualifierPolymorphism(ProcessingEnvironment env,
AnnotatedTypeFactory factory)
Creates a
QualifierPolymorphism instance that uses the given checker for querying
type qualifiers and the given factory for getting annotated types. |
| Modifier and Type | Method and Description |
|---|---|
void |
annotate(AnnotatedTypeMirror.AnnotatedExecutableType functionalInterface,
AnnotatedTypeMirror.AnnotatedExecutableType memberReference) |
void |
annotate(MethodInvocationTree tree,
AnnotatedTypeMirror.AnnotatedExecutableType type)
Resolves polymorphism annotations for the given type.
|
void |
annotate(NewClassTree tree,
AnnotatedTypeMirror.AnnotatedExecutableType type) |
static AnnotationMirror |
getPolymorphicQualifier(AnnotationMirror qual) |
static Class<? extends Annotation> |
getPolymorphicQualifierTop(Elements elements,
AnnotationMirror qual)
Returns null if the qualifier is not polymorphic.
|
static boolean |
isPolyAll(AnnotationMirror qual) |
static boolean |
isPolymorphicQualified(AnnotationMirror qual) |
protected final Map<AnnotationMirror,AnnotationMirror> polyQuals
protected final Set<? extends AnnotationMirror> topQuals
protected final QualifierHierarchy qualhierarchy
public QualifierPolymorphism(ProcessingEnvironment env, AnnotatedTypeFactory factory)
QualifierPolymorphism instance that uses the given checker for querying
type qualifiers and the given factory for getting annotated types.env - the processing environmentfactory - the factory for the current checkerpublic static AnnotationMirror getPolymorphicQualifier(AnnotationMirror qual)
public static boolean isPolymorphicQualified(AnnotationMirror qual)
public static boolean isPolyAll(AnnotationMirror qual)
public static Class<? extends Annotation> getPolymorphicQualifierTop(Elements elements, AnnotationMirror qual)
public void annotate(MethodInvocationTree tree, AnnotatedTypeMirror.AnnotatedExecutableType type)
tree - the tree associated with the typetype - the type to annotatepublic void annotate(NewClassTree tree, AnnotatedTypeMirror.AnnotatedExecutableType type)
public void annotate(AnnotatedTypeMirror.AnnotatedExecutableType functionalInterface, AnnotatedTypeMirror.AnnotatedExecutableType memberReference)