checkers.util
Class GraphQualifierHierarchy

java.lang.Object
  extended by checkers.types.QualifierHierarchy
      extended by checkers.util.GraphQualifierHierarchy

public class GraphQualifierHierarchy
extends QualifierHierarchy

Represents the type qualifier hierarchy of a type system. This class is immutable and can be only created through GraphQualifierHierarchy.Factory.


Nested Class Summary
static class GraphQualifierHierarchy.Factory
          Factory used to create an instance of GraphQualifierHierarchy.
 
Constructor Summary
protected GraphQualifierHierarchy(GraphQualifierHierarchy h)
           
 
Method Summary
 AnnotationMirror getRootAnnotation()
          Returns the root qualifier for this hierarchy.
 Set<Name> getTypeQualifiers()
          Returns the names of all type qualifiers in this type qualifier hierarchy
 boolean isSubtype(AnnotationMirror anno1, AnnotationMirror anno2)
          Most qualifiers have no value fields.
 AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
          Returns the least upper bound for a1 and a2 qualifiers.
 
Methods inherited from class checkers.types.QualifierHierarchy
difference, intersect, isSubtype, leastUpperBound, validQualifier, validQualifiers, wrapCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphQualifierHierarchy

protected GraphQualifierHierarchy(GraphQualifierHierarchy h)
Method Detail

getRootAnnotation

public AnnotationMirror getRootAnnotation()
Returns the root qualifier for this hierarchy. The root qualifier is inferred from the hierarchy, as being the only one without any super qualifiers

Specified by:
getRootAnnotation in class QualifierHierarchy
Returns:
the root (ultimate super) type qualifier in the hierarchy

getTypeQualifiers

public Set<Name> getTypeQualifiers()
Description copied from class: QualifierHierarchy
Returns the names of all type qualifiers in this type qualifier hierarchy

Specified by:
getTypeQualifiers in class QualifierHierarchy
Returns:
the fully qualified name represented in this hierarchy

leastUpperBound

public AnnotationMirror leastUpperBound(AnnotationMirror a1,
                                        AnnotationMirror a2)
Description copied from class: QualifierHierarchy
Returns the least upper bound for a1 and a2 qualifiers. Examples: For NonNull, leastUpperBound('Nullable', 'NonNull') ==> Nullable For IGJ, leastUpperBound('Immutable', 'Mutable') ==> ReadOnly

Specified by:
leastUpperBound in class QualifierHierarchy
Returns:
the least restrictive qualifiers for both types

isSubtype

public boolean isSubtype(AnnotationMirror anno1,
                         AnnotationMirror anno2)
Most qualifiers have no value fields. However, two annotations with values are subtype of each other only if they have the same values. i.e. I(m) is a subtype of I(n) iff m = n When client specifies an annotation, a1, to be a subtype of annotation with values, a2, then a1 is a subtype of all instances of a2 regardless of a2 values. i.e. IGJBottom is a subtype of all instances of @I.

Specified by:
isSubtype in class QualifierHierarchy
Returns:
true iff anno1 is a sub qualifier of anno2