checkers.interned
Class InternedAnnotatedTypeFactory

java.lang.Object
  extended by checkers.types.AnnotatedTypeFactory
      extended by checkers.interned.InternedAnnotatedTypeFactory

public class InternedAnnotatedTypeFactory
extends AnnotatedTypeFactory

An AnnotatedTypeFactory that accounts for the properties of the Interned type system. This type factory will add the Interned annotation to a type if the input: 1. is a String literal 2. is a class literal 3. has an enum type 4. has a primitive type 5. has the type java.lang.Class 6. is a call to the method String.intern()


Field Summary
 
Fields inherited from class checkers.types.AnnotatedTypeFactory
annotations, atypes, checker, elements, env, qualHierarchy, root, trees, types, visitorState
 
Constructor Summary
InternedAnnotatedTypeFactory(InternedChecker checker, CompilationUnitTree root)
          Creates a new InternedAnnotatedTypeFactory that operates on a particular AST.
 
Method Summary
protected  void annotateImplicit(Element elt, AnnotatedTypeMirror type)
          Adds implicit annotations to a type obtained from a Element.
protected  void annotateImplicit(Tree tree, AnnotatedTypeMirror type)
          Adds implicit annotations to a type obtained from a Tree.
 AnnotatedTypeMirror.AnnotatedPrimitiveType getUnboxedType(AnnotatedTypeMirror.AnnotatedDeclaredType type)
          returns the annotated primitive type of the given declared type if it is a boxed declared type.
 
Methods inherited from class checkers.types.AnnotatedTypeFactory
annotateInheritedFromClass, constructorFromUse, createLRUCache, declarationFromElement, fromClass, fromElement, fromElement, fromElement, fromExpression, fromMember, fromTypeTree, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFromTypeTree, getBoxedType, getCurrentClassType, getCurrentMethodReceiver, getPath, getReceiver, getSelfType, getVisitorState, isSupportedQualifier, methodFromUse, postAsMemberOf, postDirectSuperTypes, type, unify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternedAnnotatedTypeFactory

public InternedAnnotatedTypeFactory(InternedChecker checker,
                                    CompilationUnitTree root)
Creates a new InternedAnnotatedTypeFactory that operates on a particular AST.

Parameters:
checker - the checker to use
root - the AST on which this type factory operates
Method Detail

annotateImplicit

protected void annotateImplicit(Element elt,
                                AnnotatedTypeMirror type)
Description copied from class: AnnotatedTypeFactory
Adds implicit annotations to a type obtained from a Element. By default, this method does nothing. Subclasses should use this method to implement implicit annotations specific to their type systems.

Overrides:
annotateImplicit in class AnnotatedTypeFactory
Parameters:
elt - an element
type - the type obtained from elt

annotateImplicit

protected void annotateImplicit(Tree tree,
                                AnnotatedTypeMirror type)
Description copied from class: AnnotatedTypeFactory
Adds implicit annotations to a type obtained from a Tree. By default, this method does nothing. Subclasses should use this method to implement implicit annotations specific to their type systems.

Overrides:
annotateImplicit in class AnnotatedTypeFactory
Parameters:
tree - an AST node
type - the type obtained from tree

getUnboxedType

public AnnotatedTypeMirror.AnnotatedPrimitiveType getUnboxedType(AnnotatedTypeMirror.AnnotatedDeclaredType type)
Description copied from class: AnnotatedTypeFactory
returns the annotated primitive type of the given declared type if it is a boxed declared type. Otherwise, it throws IllegalArgumentException exception. The returned type would have the annotations on the given type and nothing else.

Overrides:
getUnboxedType in class AnnotatedTypeFactory
Parameters:
type - the declared type
Returns:
the unboxed primitive type