public class QualifierPolymorphism extends @NonNull Object
annotate(MethodInvocationTree, AnnotatedTypeMirror.AnnotatedExecutableType)
to the
AnnotatedTypeFactory.annotateImplicit(Tree, AnnotatedTypeMirror)
and
AnnotatedTypeFactory.annotateImplicit(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<@Nullable AnnotationMirror,@Nullable 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<@Nullable AnnotationMirror> |
topQuals
The qualifiers at the top of the qualifier hierarchy.
|
Constructor and Description |
---|
QualifierPolymorphism(BaseTypeChecker checker,
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(MethodInvocationTree tree,
AnnotatedTypeMirror.AnnotatedExecutableType type)
Resolves polymorphism annotations for the given type.
|
void |
annotate(NewClassTree tree,
AnnotatedTypeMirror.AnnotatedExecutableType type) |
static @Nullable AnnotationMirror |
getPolymorphicQualifier(@Nullable AnnotationMirror qual) |
static Class<? extends Annotation> |
getPolymorphicQualifierTop(@Nullable AnnotationMirror qual) |
static boolean |
isPolyAll(@Nullable AnnotationMirror qual) |
static boolean |
isPolymorphicQualified(@Nullable AnnotationMirror qual) |
protected final Map<@Nullable AnnotationMirror,@Nullable AnnotationMirror> polyQuals
protected final Set<@Nullable AnnotationMirror> topQuals
protected final QualifierHierarchy qualhierarchy
public QualifierPolymorphism(BaseTypeChecker checker, AnnotatedTypeFactory factory)
QualifierPolymorphism
instance that uses the given
checker for querying type qualifiers and the given factory for getting
annotated types.checker
- the current checkerfactory
- the factory for the current checkerpublic static @Nullable AnnotationMirror getPolymorphicQualifier(@Nullable AnnotationMirror qual)
public static boolean isPolymorphicQualified(@Nullable AnnotationMirror qual)
public static boolean isPolyAll(@Nullable AnnotationMirror qual)
public static Class<? extends Annotation> getPolymorphicQualifierTop(@Nullable 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)