checkers.types
Class QualifierHierarchy

java.lang.Object
  extended by checkers.types.QualifierHierarchy
Direct Known Subclasses:
GraphQualifierHierarchy

public abstract class QualifierHierarchy
extends Object

Represents the relationship hierarchy of some given type qualifiers. All method parameter annotations need to be type qualifiers recognized within this hierarchy.


Constructor Summary
QualifierHierarchy()
           
 
Method Summary
 AnnotationMirror getAnnotation(Collection<AnnotationMirror> annos)
          Finds the first type qualifiers in this hierarchy in the given list of qualifiers.
 List<AnnotationMirror> getAnnotations(Collection<AnnotationMirror> annos)
          Finds the type qualifiers recognized within this hierarchy in the passed collections.
abstract  AnnotationMirror getRootAnnotation()
           
abstract  Set<Name> getTypeQualifiers()
          Returns the names of the type qualifiers recognized within this type qualifier hierarchy
abstract  boolean isInConflict(AnnotationMirror anno1, AnnotationMirror anno2)
          Check if the two annotations are in conflict.
abstract  boolean isSubtype(AnnotationMirror anno1, AnnotationMirror anno2)
          Tests whether anno1 is a super qualifier anno2, according to the type qualifiers hierarchy.
 boolean isSubtype(Collection<AnnotationMirror> rhs, Collection<AnnotationMirror> lhs)
          Tests whether there is any annotation in lhs that is a super qualifier of an annotation in rhs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QualifierHierarchy

public QualifierHierarchy()
Method Detail

isSubtype

public abstract boolean isSubtype(AnnotationMirror anno1,
                                  AnnotationMirror anno2)
Tests whether anno1 is a super qualifier anno2, according to the type qualifiers hierarchy.

Parameters:
anno2 - a type qualifier
anno1 - a type qualifier
Returns:
true iff anno1 is a sub qualifier of anno2

isInConflict

public abstract boolean isInConflict(AnnotationMirror anno1,
                                     AnnotationMirror anno2)
Check if the two annotations are in conflict. Two qualifiers are in conflict if both cannot annotate a type together.

Parameters:
anno1 - a type qualifier
anno2 - a type qualifier
Returns:
true iff anno1 and anno2 in conflict

getRootAnnotation

public abstract AnnotationMirror getRootAnnotation()
Returns:
the root (ultimate super) type qualifier in the hierarchy

getAnnotations

public List<AnnotationMirror> getAnnotations(Collection<AnnotationMirror> annos)
Finds the type qualifiers recognized within this hierarchy in the passed collections.

Parameters:
annos - a collection of annotations
Returns:
the qualifiers in annos within this hierarchy

getAnnotation

public AnnotationMirror getAnnotation(Collection<AnnotationMirror> annos)
Finds the first type qualifiers in this hierarchy in the given list of qualifiers.

Parameters:
annos - a collection of annotations
Returns:
the qualifiers in annos in this hierarchy

getTypeQualifiers

public abstract Set<Name> getTypeQualifiers()
Returns the names of the type qualifiers recognized within this type qualifier hierarchy

Returns:
the fully qualified name represented in this hierarchy

isSubtype

public boolean isSubtype(Collection<AnnotationMirror> rhs,
                         Collection<AnnotationMirror> lhs)
Tests whether there is any annotation in lhs that is a super qualifier of an annotation in rhs.

Returns:
true iff an annotation in lhs is a super of one in rhs