checkers.util
Class QualifierPolymorphism

java.lang.Object
  extended by checkers.util.QualifierPolymorphism

public class QualifierPolymorphism
extends Object

Implements framework support for type qualifier polymorphism. Checkers that wish to use it should add calls to #annotate(MethodInvocationTree, AnnotatedExecutableType) and annotate(Element, AnnotatedTypeMirror) 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.

See Also:
PolymorphicQualifier

Field Summary
protected  AnnotationMirror polyQual
          The polymorphic qualifier.
protected  AnnotationMirror rootQual
          The qualifier at the root of the hierarchy.
 
Constructor Summary
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.
 
Method Summary
 void annotate(Element elt, AnnotatedTypeMirror type)
          Resolves polymorphism annotations for the given type.
 void annotate(MethodInvocationTree tree, AnnotatedTypeMirror.AnnotatedExecutableType type)
          Resolves polymorphism annotations for the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

polyQual

protected final AnnotationMirror polyQual
The polymorphic qualifier.


rootQual

protected final AnnotationMirror rootQual
The qualifier at the root of the hierarchy.

Constructor Detail

QualifierPolymorphism

public 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.

Parameters:
checker - the current checker
factory - the factory for the current checker
Method Detail

annotate

public void annotate(Element elt,
                     AnnotatedTypeMirror type)
Resolves polymorphism annotations for the given type.

Parameters:
elt - the element associated with the type
type - the type to annotate

annotate

public void annotate(MethodInvocationTree tree,
                     AnnotatedTypeMirror.AnnotatedExecutableType type)
Resolves polymorphism annotations for the given type.

Parameters:
tree - the tree associated with the type
type - the type to annotate