|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object checkers.types.AnnotatedTypeFactory checkers.nullness.NullnessAnnotatedTypeFactory
public class NullnessAnnotatedTypeFactory
Adds the NonNull
annotation to a type that is:
1. in the scope of a DefaultQualifier
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
Adds the Raw
annotation to
10. the receiver type of constructors.
Additionally, the type factory will add the Nullable
annotation to a
type if the input is
11. the null literal
12. of type Void
,
13. may resolve the types of some NonNull
fields as Nullable
depending on the presence of a Raw
annotation on a constructor
or method receiver. Please review
the Checker Framework for Raw
semantics.
Field Summary | |
---|---|
protected AnnotationMirror |
NONNULL
Represents the Nullness Checker qualifiers |
protected AnnotationMirror |
NULLABLE
Represents the Nullness Checker qualifiers |
protected AnnotationMirror |
RAW
Represents the Nullness Checker qualifiers |
Fields inherited from class checkers.types.AnnotatedTypeFactory |
---|
annotations, atypes, elements, env, qualHierarchy, root, trees, types, visitorState |
Constructor Summary | |
---|---|
NullnessAnnotatedTypeFactory(NullnessChecker checker,
CompilationUnitTree root)
Creates a NullnessAnnotatedTypeFactory . |
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 . |
protected AnnotatedTypeMirror.AnnotatedDeclaredType |
getImplicitReceiverType(Tree tree)
|
AnnotatedTypeMirror.AnnotatedExecutableType |
methodFromUse(MethodInvocationTree tree)
Determines the type of the invoked method based on the passed method invocation tree. |
protected void |
postDirectSuperTypes(AnnotatedTypeMirror type,
List<? extends AnnotatedTypeMirror> supertypes)
A callback method for the AnnotatedTypeFactory subtypes to customize directSuperTypes(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final AnnotationMirror NONNULL
protected final AnnotationMirror RAW
protected final AnnotationMirror NULLABLE
Constructor Detail |
---|
public NullnessAnnotatedTypeFactory(NullnessChecker checker, CompilationUnitTree root)
NullnessAnnotatedTypeFactory
.
Method Detail |
---|
protected void annotateImplicit(Element elt, AnnotatedTypeMirror type)
AnnotatedTypeFactory
Element
. By
default, this method does nothing. Subclasses should use this method to
implement implicit annotations specific to their type systems.
annotateImplicit
in class AnnotatedTypeFactory
elt
- an elementtype
- the type obtained from elt
protected void annotateImplicit(Tree tree, AnnotatedTypeMirror type)
AnnotatedTypeFactory
Tree
. By
default, this method does nothing. Subclasses should use this method to
implement implicit annotations specific to their type systems.
annotateImplicit
in class AnnotatedTypeFactory
tree
- an AST nodetype
- the type obtained from tree
protected AnnotatedTypeMirror.AnnotatedDeclaredType getImplicitReceiverType(Tree tree)
getImplicitReceiverType
in class AnnotatedTypeFactory
protected void postDirectSuperTypes(AnnotatedTypeMirror type, List<? extends AnnotatedTypeMirror> supertypes)
AnnotatedTypeFactory
postDirectSuperTypes
in class AnnotatedTypeFactory
type
- the type whose supertypes are desiredsupertypes
- the supertypes as specified by the base AnnotatedTypeFactorypublic AnnotatedTypeMirror.AnnotatedExecutableType methodFromUse(MethodInvocationTree tree)
AnnotatedTypeFactory
AnnotatedTypes.asMemberOf(AnnotatedTypeMirror, Element)
, and
customization based on receiver type should be in accordance to its
specification.
methodFromUse
in class AnnotatedTypeFactory
tree
- the method invocation tree
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |