|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object checkers.types.AnnotatedTypeFactory checkers.types.BasicAnnotatedTypeFactory<Checker>
public class BasicAnnotatedTypeFactory<Checker extends BaseTypeChecker> extends AnnotatedTypeFactory
A factory that extends AnnotatedTypeFactory
to optionally use
flow-sensitive qualifier inference, qualifier polymorphism, implicit annotations
via ImplicitFor
, and user-specified defaults via DefaultQualifier
Flow
Modifier and Type | Class and Description |
---|
Nested classes/interfaces inherited from class checkers.types.AnnotatedTypeFactory |
---|
AnnotatedTypeFactory.InheritedFromClassAnnotator |
Modifier and Type | Field and Description |
---|---|
protected QualifierDefaults |
defaults
to handle defaults specified by the user |
protected Flow |
flow
Flow sensitive instance |
protected static boolean |
FLOW_BY_DEFAULT
should use flow by default |
protected QualifierPolymorphism |
poly
to handle any polymorphic types |
protected TreeAnnotator |
treeAnnotator
to annotate types based on the given un-annotated types |
protected TypeAnnotator |
typeAnnotator
to annotate types based on the given tree |
protected boolean |
useFlow
Should use flow analysis? |
Fields inherited from class checkers.types.AnnotatedTypeFactory |
---|
annotations, atypes, elements, env, qualHierarchy, root, trees, types, visitorState |
Constructor and Description |
---|
BasicAnnotatedTypeFactory(Checker checker,
CompilationUnitTree root)
Creates a type factory for checking the given compilation unit with respect to the given annotation. |
BasicAnnotatedTypeFactory(Checker checker,
CompilationUnitTree root,
boolean useFlow)
Creates a type factory for checking the given compilation unit with respect to the given annotation. |
Modifier and Type | Method and Description |
---|---|
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 Flow |
createFlow(Checker checker,
CompilationUnitTree root,
Set<AnnotationMirror> flowQuals)
Returns a Flow instance that performs flow sensitive analysis
to infer qualifiers on unqualified types. |
protected Set<AnnotationMirror> |
createFlowQualifiers(Checker checker)
Returns the set of annotations to be inferred in flow analysis |
protected TreeAnnotator |
createTreeAnnotator(Checker checker)
Returns a TreeAnnotator that adds annotations to a type based
on the contents of a tree. |
protected TypeAnnotator |
createTypeAnnotator(Checker checker)
Returns a TypeAnnotator that adds annotations to a type based
on the content of the type itself. |
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 static boolean FLOW_BY_DEFAULT
protected final TypeAnnotator typeAnnotator
protected final TreeAnnotator treeAnnotator
protected final QualifierPolymorphism poly
protected final QualifierDefaults defaults
protected boolean useFlow
protected final Flow flow
Constructor Detail |
---|
public BasicAnnotatedTypeFactory(Checker checker, CompilationUnitTree root, boolean useFlow)
checker
- the checker to which this type factory belongsroot
- the compilation unit to scanuseFlow
- whether flow analysis should be performedpublic BasicAnnotatedTypeFactory(Checker checker, CompilationUnitTree root)
checker
- the checker to which this type factory belongsroot
- the compilation unit to scanMethod Detail |
---|
protected TreeAnnotator createTreeAnnotator(Checker checker)
TreeAnnotator
that adds annotations to a type based
on the contents of a tree.
Subclasses may override this method to specify more appriopriate
TreeAnnotator
protected TypeAnnotator createTypeAnnotator(Checker checker)
TypeAnnotator
that adds annotations to a type based
on the content of the type itself.
protected Flow createFlow(Checker checker, CompilationUnitTree root, Set<AnnotationMirror> flowQuals)
Flow
instance that performs flow sensitive analysis
to infer qualifiers on unqualified types.
checker
- the checkerroot
- the compilation unit associated with this factoryflowQuals
- the qualifiers to inferprotected 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 AnnotatedTypeFactoryprotected 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 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
public 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 treeprotected Set<AnnotationMirror> createFlowQualifiers(Checker checker)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |