checkers.interning
Class InterningAnnotatedTypeFactory
java.lang.Object
checkers.types.AnnotatedTypeFactory
checkers.types.BasicAnnotatedTypeFactory<InterningChecker>
checkers.interning.InterningAnnotatedTypeFactory
public class InterningAnnotatedTypeFactory
- extends BasicAnnotatedTypeFactory<InterningChecker>
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(). The method is the only
interning method in the JDK, so there is no need of an annotated JDK.
This factory extends BasicAnnotatedTypeFactory and inhereits its
functionalities: flow-sensitive qualifier inference, qualifier polymorphism
(of PolyInterned), implicit annotations via ImplicitFor
(to handle cases 1, 4), and user-specified defaults via Default.
| 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, postAsMemberOf, postDirectSuperTypes, unify |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InterningAnnotatedTypeFactory
public InterningAnnotatedTypeFactory(InterningChecker checker,
CompilationUnitTree root)
- Creates a new
InterningAnnotatedTypeFactory that operates on a
particular AST.
- Parameters:
checker - the checker to useroot - the AST on which this type factory operates
createTypeAnnotator
protected TypeAnnotator createTypeAnnotator(InterningChecker checker)
- Description copied from class:
BasicAnnotatedTypeFactory
- Returns a
TypeAnnotator that adds annotations to a type based
on the content of the type itself.
- Overrides:
createTypeAnnotator in class BasicAnnotatedTypeFactory<InterningChecker>
- Returns:
- a type annotator
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