mahmood at MIT.EDU
Sun Aug 17 22:25:36 EDT 2008
> The qualifier hierarchy is a bit confusing when you are using a type
> system that has multiple interacting annotations.
I assume you are talking about cases where a type has more than one
qualifier that belong to the same qualifier hierarchy.
QualifierHierarchy is not designed to do that. While qualifiers could
interact, in many cases such qualifiers are actually part of
interacting qualifier hierarchies and not one only. Can you provide
some cases where annotations interact?
I recommend that, if possible, you add extra annotations (or have
annotation values) that represent the combination of the two rather
than have two annotations, e.g. I would rather have @Critical
> The public abstract method use 2 AnnotationMirrors. For the
> isSubtype, the spec says to return true iff anno1 is a sub-qualifier
> of anno2.
> This is unclear in situations where the annotations interact, and a
> single annotation can not be taken by itself.
I think it's safe to make such method a protected method, and only
expose the methods that accept Collection<AnnotationMirror>.
I can add to the specification when should the ones that accept 2
AnnotationsMirrors are called vs. 2 Collection<AnnotationMirror>.
> These methods also do not include the actual type the annotations
> are on; e.g. @Constrained(UIResource.class) could indicate that the
> type cannot be assigned to any reference that does not implement the
> UIResource interface.
This is possible by using TypeHierarchy rather than
QualifierHierarchy, as here you are testing type relations rather than
qualifier relations. Umm.. is there a reason why you cannot simply
declare the type UIResource (or a subtype of UIResource)? I
understand that there are some limitations to what you can do with
Java types, but I don't think that this one of these reasonable cases.
In my next iteration of QualifierHierarchy and TypeHierarchy, I would
try to improve the specification to address some of these issues though.
More information about the checkers