|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcheckers.types.AnnotatedTypeFactory
checkers.nullness.NullnessAnnotatedTypeFactory
public class NullnessAnnotatedTypeFactory
Adds the NonNull
annotation to a type that is:
null
literal)
DefaultQualifier
annotation and
matches its location criteria
NonNull
by flow-sensitive inference
Raw
annotation to
Additionally, the type factory will add the Nullable
annotation to a
type if the input is
Void
,
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class checkers.types.AnnotatedTypeFactory |
---|
AnnotatedTypeFactory.InheritedFromClassAnnotator |
Field Summary | |
---|---|
protected AnnotationMirror |
LAZYNONNULL
Represents the Nullness Checker qualifiers |
protected AnnotationMirror |
NONNULL
Represents the Nullness Checker qualifiers |
protected AnnotationMirror |
NULLABLE
Represents the Nullness Checker qualifiers |
protected AnnotationMirror |
POLYNULL
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 . |
AnnotatedTypeMirror.AnnotatedExecutableType |
constructorFromUse(NewClassTree tree)
Determines the AnnotatedTypeMirror.AnnotatedExecutableType of a constructor
invocation. |
AnnotatedTypeMirror.AnnotatedDeclaredType |
getEnclosingType(TypeElement element,
Tree 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 POLYNULL
protected final AnnotationMirror NONNULL
protected final AnnotationMirror RAW
protected final AnnotationMirror NULLABLE
protected final AnnotationMirror LAZYNONNULL
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
public final AnnotatedTypeMirror.AnnotatedDeclaredType getEnclosingType(TypeElement element, Tree tree)
getEnclosingType
in class AnnotatedTypeFactory
protected void postDirectSuperTypes(AnnotatedTypeMirror type, List<? extends AnnotatedTypeMirror> supertypes)
AnnotatedTypeFactory
type
annotations to
supertypes
. This allows the type
and its supertypes
to have the qualifiers, e.g. the supertypes of an Immutable
type are also Immutable
.
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
public AnnotatedTypeMirror.AnnotatedExecutableType constructorFromUse(NewClassTree tree)
AnnotatedTypeFactory
AnnotatedTypeMirror.AnnotatedExecutableType
of a constructor
invocation. Note that this is different than calling
AnnotatedTypeFactory.getAnnotatedType(Tree)
or
AnnotatedTypeFactory.fromExpression(ExpressionTree)
on the constructor invocation;
those determine the type of the result of invoking the
constructor, which is probably an AnnotatedTypeMirror.AnnotatedDeclaredType
.
constructorFromUse
in class AnnotatedTypeFactory
tree
- a constructor invocation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |