public class LessThanAnnotatedTypeFactory extends BaseAnnotatedTypeFactory
GenericAnnotatedTypeFactory.ScanStateAnnotatedTypeFactory.ParameterizedExecutableType| Modifier and Type | Field and Description |
|---|---|
javax.lang.model.element.AnnotationMirror |
UNKNOWN |
analysis, cfgVisualizer, defaults, dependentTypesHelper, emptyStore, flowByDefault, flowResult, flowResultAnalysisCaches, initializationStaticStore, initializationStore, methodInvocationStores, poly, regularExitStores, returnStatementStores, scannedClasses, transfer, treeAnnotator, typeAnnotatorchecker, elements, fromExpressionTreeCache, fromMemberTreeCache, fromTypeTreeCache, ignoreUninferredTypeArguments, loader, objectGetClass, processingEnv, qualHierarchy, qualifierUpperBounds, reflectionResolver, root, shouldCache, trees, typeArgumentInference, typeFormatter, typeHierarchy, types, typeVarSubstitutor, uid, visitorState| Constructor and Description |
|---|
LessThanAnnotatedTypeFactory(BaseTypeChecker checker) |
| Modifier and Type | Method and Description |
|---|---|
protected DependentTypesHelper |
createDependentTypesHelper()
Creates an
DependentTypesHelper and returns it. |
javax.lang.model.element.AnnotationMirror |
createLessThanQualifier(java.util.List<java.lang.String> expressions)
Creates a less than qualifier given the expressions.
|
javax.lang.model.element.AnnotationMirror |
createLessThanQualifier(java.lang.String expression)
Returns
@LessThan(expression). |
QualifierHierarchy |
createQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory factory)
Factory method to easily change what QualifierHierarchy is created.
|
protected java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> |
createSupportedTypeQualifiers()
Returns a mutable set of annotation classes that are supported by a checker.
|
static java.util.List<java.lang.String> |
getLessThanExpressions(javax.lang.model.element.AnnotationMirror annotation)
Returns a modifiable list of expressions in the annotation sorted.
|
java.util.List<java.lang.String> |
getLessThanExpressions(com.sun.source.tree.ExpressionTree expression)
Returns a sorted, modifiable list of expressions that
expression is less than. |
ValueAnnotatedTypeFactory |
getValueAnnotatedTypeFactory()
Returns the Value Checker's annotated type factory.
|
static boolean |
isLessThan(javax.lang.model.element.AnnotationMirror left,
java.lang.String right) |
boolean |
isLessThan(com.sun.source.tree.Tree left,
java.lang.String right) |
boolean |
isLessThanByValue(com.sun.source.tree.Tree smaller,
java.lang.String bigger,
com.sun.source.util.TreePath path) |
static boolean |
isLessThanOrEqual(javax.lang.model.element.AnnotationMirror left,
java.lang.String right) |
boolean |
isLessThanOrEqual(com.sun.source.tree.Tree left,
java.lang.String right) |
createFlowAnalysisaddAnnotationsFromDefaultQualifierForUse, addCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotations, addDefaultAnnotations, addUncheckedCodeDefaults, addUncheckedStandardDefaults, analyze, applyInferredAnnotations, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, createAndInitQualifierDefaults, createCFGVisualizer, createDefaultForUseTypeAnnotator, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, createTreeAnnotator, createTypeAnnotator, fromNewClass, getAnnotatedTypeLhs, getAnnotatedTypeLhsNoTypeVarDefault, getAnnotatedTypeRhsUnaryAssign, getAnnotatedTypeVarargsArray, getAnnotationFromJavaExpressionString, getAnnotationFromReceiver, getAnnotationMirrorFromJavaExpressionString, getCFGVisualizer, getDependentTypesHelper, getEmptyStore, getFinalLocalValues, getFirstNodeOfKindForTree, getInferredValueFor, getMethodReturnType, getMethodReturnType, getNodesForTree, getQualifierPolymorphism, getReceiverAndOffsetFromJavaExpressionString, getReceiverFromJavaExpressionString, getRegularExitStore, getResultingTypeOfConstructorMemberReference, getReturnStatementStores, getShouldDefaultTypeVarLocals, getSortedQualifierNames, getStoreAfter, getStoreAfter, getStoreAfter, getStoreBefore, getStoreBefore, getStoreBefore, getSupportedMonotonicTypeQualifiers, getTypeFactoryOfSubchecker, handleCFGViz, methodFromUse, performFlowAnalysis, postDirectSuperTypes, postInit, preProcessClassTree, setRoot, typeVariablesFromUseadaptGetClassReturnTypeToReceiver, addAliasedAnnotation, addAliasedAnnotation, addAliasedAnnotation, addAliasedAnnotation, addAliasedDeclAnnotation, addAnnotationFromFieldInvariant, addInheritedAnnotation, canonicalAnnotation, checkInvalidOptionsInferSignatures, createAnnotatedTypeFormatter, createAnnotationClassLoader, createAnnotationFormatter, createQualifierHierarchy, createQualifierHierarchy, createQualifierHierarchyFactory, createQualifierUpperBounds, createTypeArgumentInference, createTypeHierarchy, createTypeVariableSubstitutor, declarationFromElement, fromElement, fromElement, fromElement, getAnnotatedNullType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFormatter, getAnnotatedTypeFromTypeTree, getAnnotationFormatter, getAnnotationMirror, getAnnotationWithMetaAnnotation, getBoxedType, getBundledTypeQualifiersWithoutPolyAll, getBundledTypeQualifiersWithPolyAll, getCacheSize, getContext, getCurrentClassTree, getCurrentClassType, getCurrentMethodReceiver, getDeclAnnotation, getDeclAnnotationNoAliases, getDeclAnnotations, getDeclAnnotationWithMetaAnnotation, getDefaultTypeDeclarationBounds, getDummyAssignedTo, getElementUtils, getEnclosingElementForArtificialTree, getEnclosingType, getExpressionAndOffset, getFieldInvariantAnnotationTree, getFieldInvariantDeclarationAnnotations, getFieldInvariants, getFnInterfaceFromTree, getFnInterfaceFromTree, getImplicitReceiverType, getNarrowedPrimitive, getPath, getProcessingEnv, getQualifierHierarchy, getReceiverType, getSelfType, getStringType, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeDeclarationBounds, getTypeHierarchy, getTypeOfExtendsImplements, getTypeVarSubstitutor, getUnboxedType, getUninferredWildcardType, getVisitorState, getWholeProgramInference, initializeReflectionResolution, isAnyEnclosingThisDeref, isFromByteCode, isFromStubFile, isMostEnclosingThisDeref, isSupportedQualifier, isWithinConstructor, methodFromUse, negateConstant, parseStubFiles, postAsMemberOf, postProcessClassTree, postTypeVarSubstitution, setEnclosingElementForArtificialTree, shouldWarnIfStubRedundantWithBytecode, toAnnotatedType, toString, type, widenToUpperBoundpublic LessThanAnnotatedTypeFactory(BaseTypeChecker checker)
public ValueAnnotatedTypeFactory getValueAnnotatedTypeFactory()
protected java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> createSupportedTypeQualifiers()
AnnotatedTypeFactorySubclasses may override this method to return a mutable set of their supported type qualifiers through one of the 5 approaches shown below.
Subclasses should not call this method; they should call AnnotatedTypeFactory.getSupportedTypeQualifiers() instead.
By default, a checker supports PolyAll, and all annotations located in a
subdirectory called qual that's located in the same directory as the checker. Note
that only annotations defined with the @Target({ElementType.TYPE_USE})
meta-annotation (and optionally with the additional value of ElementType.TYPE_PARAMETER, but no other ElementType values) are automatically
considered as supported annotations.
To not support PolyAll, see examples below.
To support a different set of annotations than those in the qual subdirectory,
or that have other ElementType values, see examples below.
In total, there are 5 ways to indicate annotations that are supported by a checker:
PolyAll:
This is the default behavior. Simply place those annotations within the qual directory.
PolyAll:
Place those annotations within the qual directory, and override AnnotatedTypeFactory.createSupportedTypeQualifiers() by calling AnnotatedTypeFactory.getBundledTypeQualifiersWithPolyAll(Class...) with no parameters passed in. Code
example:
@Override protected Set<Class<? extends Annotation>> createSupportedTypeQualifiers() {
return getBundledTypeQualifiersWithoutPolyAll();
}
PolyAll,
and a list of other annotations:
Place those annotations within the qual directory, and override AnnotatedTypeFactory.createSupportedTypeQualifiers() by calling AnnotatedTypeFactory.getBundledTypeQualifiersWithPolyAll(Class...) with a varargs parameter list of the
other annotations. Code example:
@Override protected Set<Class<? extends Annotation>> createSupportedTypeQualifiers() {
return getBundledTypeQualifiersWithPolyAll(Regex.class, PartialRegex.class, RegexBottom.class, UnknownRegex.class);
}
PolyAll:
Place those annotations within the qual directory, and override AnnotatedTypeFactory.createSupportedTypeQualifiers() by calling AnnotatedTypeFactory.getBundledTypeQualifiersWithoutPolyAll(Class...) with a varargs parameter list of the
other annotations. Code example:
@Override protected Set<Class<? extends Annotation>> createSupportedTypeQualifiers() {
return getBundledTypeQualifiersWithoutPolyAll(UnknownFormat.class, FormatBottom.class);
}
AnnotatedTypeFactory.createSupportedTypeQualifiers() and return a mutable set of the supported
annotations. Code example:
@Override protected Set<Class<? extends Annotation>> createSupportedTypeQualifiers() {
return new HashSet<Class<? extends Annotation>>(
Arrays.asList(A.class, B.class));
}
The set of qualifiers returned by AnnotatedTypeFactory.createSupportedTypeQualifiers() must be a
fresh, mutable set. The methods AnnotatedTypeFactory.getBundledTypeQualifiersWithoutPolyAll(Class...) and AnnotatedTypeFactory.getBundledTypeQualifiersWithPolyAll(Class...) each must return a fresh, mutable set
createSupportedTypeQualifiers in class AnnotatedTypeFactoryprotected DependentTypesHelper createDependentTypesHelper()
GenericAnnotatedTypeFactoryDependentTypesHelper and returns it.createDependentTypesHelper in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>DependentTypesHelperpublic QualifierHierarchy createQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory factory)
AnnotatedTypeFactorycreateQualifierHierarchy in class AnnotatedTypeFactorypublic boolean isLessThan(com.sun.source.tree.Tree left,
java.lang.String right)
left - the first tree to compareright - the second tree to comparepublic static boolean isLessThan(javax.lang.model.element.AnnotationMirror left,
java.lang.String right)
public boolean isLessThanByValue(com.sun.source.tree.Tree smaller,
java.lang.String bigger,
com.sun.source.util.TreePath path)
smaller < bigger, using information from the Value Checkerpublic boolean isLessThanOrEqual(com.sun.source.tree.Tree left,
java.lang.String right)
public static boolean isLessThanOrEqual(javax.lang.model.element.AnnotationMirror left,
java.lang.String right)
public java.util.List<java.lang.String> getLessThanExpressions(com.sun.source.tree.ExpressionTree expression)
expression is less than. If the
expression is annotated with LessThanBottom, null is returned.public javax.lang.model.element.AnnotationMirror createLessThanQualifier(java.util.List<java.lang.String> expressions)
If expressions is null, LessThanBottom is returned. If expressions is empty,
LessThanUnknown is returned. Otherwise, LessThan(expressions) is returned.
public javax.lang.model.element.AnnotationMirror createLessThanQualifier(java.lang.String expression)
@LessThan(expression).public static java.util.List<java.lang.String> getLessThanExpressions(javax.lang.model.element.AnnotationMirror annotation)
LessThanBottom, return null. If the annotation is LessThanUnknown return the
empty list.