checkers.types
Class QualifierHierarchy

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

public abstract class QualifierHierarchy
extends Object

Represents a type qualifiers hierarchy. All method parameter annotations need to be type qualifiers recognized within this hierarchy.


Constructor Summary
QualifierHierarchy()
           
 
Method Summary
abstract  AnnotationMirror getRootAnnotation()
           
abstract  Set<Name> getTypeQualifiers()
          Returns the names of all type qualifiers in this type qualifier hierarchy
abstract  boolean inConflict(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 some annotation in rhs.
 AnnotationMirror validQualifier(Collection<AnnotationMirror> annos)
          Finds the first type qualifiers in this hierarchy in the given list of qualifiers.
 List<AnnotationMirror> validQualifiers(Collection<AnnotationMirror> annos)
          Returns a subset of the input that contains any qualifiers in this hierarchy
 
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

getRootAnnotation

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

getTypeQualifiers

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

Returns:
the fully qualified name represented in this hierarchy

isSubtype

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

Returns:
true iff anno1 is a sub qualifier of anno2

isSubtype

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

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

inConflict

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

Returns:
true iff anno1 and anno2 are in conflict

validQualifiers

public List<AnnotationMirror> validQualifiers(Collection<AnnotationMirror> annos)
Returns a subset of the input that contains any qualifiers in this hierarchy

Returns:
the qualifiers in annos within this hierarchy

validQualifier

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

Returns:
the qualifiers in annos in this hierarchy