checkers.nonnull
Class NonNullAnnotatedTypeFactory
java.lang.Object
checkers.types.AnnotatedTypeFactory
checkers.nonnull.NonNullAnnotatedTypeFactory
public class NonNullAnnotatedTypeFactory
- extends AnnotatedTypeFactory
Adds the NonNull annotation to a type that is:
1. in the scope of a Default annotation and matches its location
criteria
2. determined to be NonNull by flow-sensitive inference
3. the class in a static member access (e.g., "System" in "System.out")
4. an array-creation expression (with new)
5. an object-creation expression (with new)
6. a string literal
7. a package declaration
8. an exception parameter
9. the receiver type of a non-static (and non-constructor) method
The type factory will also add the Raw annotation to the receiver
type of constructors.
Additionally, the type factory will add the Nullable annotation to a
type if the input is the null literal or of type Void, and may
resolve the types of some NonNull fields as Nullable
depending on the presence of a Raw annotation on a constructor or
method receiver.
| 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, getUnboxedType, 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 |
NonNullAnnotatedTypeFactory
public NonNullAnnotatedTypeFactory(NonNullChecker checker,
CompilationUnitTree root)
- Creates a
NonNullAnnotatedTypeFactory.
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 elementtype - 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 nodetype - the type obtained from tree