public class QualifierPolymorphism
extends java.lang.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 java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.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 java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
topQuals
The qualifiers at the top of the qualifier hierarchy.
|
Constructor and Description |
---|
QualifierPolymorphism(javax.annotation.processing.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(com.sun.source.tree.MethodInvocationTree tree,
AnnotatedTypeMirror.AnnotatedExecutableType type)
Resolves polymorphism annotations for the given type.
|
void |
annotate(com.sun.source.tree.NewClassTree tree,
AnnotatedTypeMirror.AnnotatedExecutableType type) |
static javax.lang.model.element.AnnotationMirror |
getPolymorphicQualifier(javax.lang.model.element.AnnotationMirror qual) |
static java.lang.Class<? extends java.lang.annotation.Annotation> |
getPolymorphicQualifierTop(javax.lang.model.util.Elements elements,
javax.lang.model.element.AnnotationMirror qual)
Returns null if the qualifier is not polymorphic.
|
static boolean |
isPolyAll(javax.lang.model.element.AnnotationMirror qual) |
static boolean |
isPolymorphicQualified(javax.lang.model.element.AnnotationMirror qual) |
protected final java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> polyQuals
protected final java.util.Set<? extends javax.lang.model.element.AnnotationMirror> topQuals
protected final QualifierHierarchy qualhierarchy
public QualifierPolymorphism(javax.annotation.processing.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 javax.lang.model.element.AnnotationMirror getPolymorphicQualifier(javax.lang.model.element.AnnotationMirror qual)
public static boolean isPolymorphicQualified(javax.lang.model.element.AnnotationMirror qual)
public static boolean isPolyAll(javax.lang.model.element.AnnotationMirror qual)
public static java.lang.Class<? extends java.lang.annotation.Annotation> getPolymorphicQualifierTop(javax.lang.model.util.Elements elements, javax.lang.model.element.AnnotationMirror qual)
public void annotate(com.sun.source.tree.MethodInvocationTree tree, AnnotatedTypeMirror.AnnotatedExecutableType type)
tree
- the tree associated with the typetype
- the type to annotatepublic void annotate(com.sun.source.tree.NewClassTree tree, AnnotatedTypeMirror.AnnotatedExecutableType type)
public void annotate(AnnotatedTypeMirror.AnnotatedExecutableType functionalInterface, AnnotatedTypeMirror.AnnotatedExecutableType memberReference)