public class IndexUtil
extends java.lang.Object
Constructor and Description |
---|
IndexUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Long |
getExactValue(Tree tree,
org.checkerframework.common.value.ValueAnnotatedTypeFactory factory)
Either returns the exact value of the given tree according to the Constant Value Checker, or
null if the exact value is not known.
|
static ExpressionTree |
getLengthSequenceTree(Tree lengthTree,
IndexMethodIdentifier imf,
javax.annotation.processing.ProcessingEnvironment processingEnv)
Gets a sequence tree for a length access tree, or null if it is not a length access.
|
static java.lang.Long |
getMaxValue(Tree tree,
org.checkerframework.common.value.ValueAnnotatedTypeFactory factory)
Finds the maximum value in a Value Checker type.
|
static int |
getMinLen(Tree tree,
org.checkerframework.common.value.ValueAnnotatedTypeFactory valueAnnotatedTypeFactory)
Queries the Value Checker to determine if there is a known minimum length for the array
represented by
tree . |
static java.lang.Integer |
getMinLenFromTree(Tree tree,
org.checkerframework.common.value.ValueAnnotatedTypeFactory valueATF)
Looks up the minlen of a member select tree.
|
static java.lang.Long |
getMinValue(Tree tree,
org.checkerframework.common.value.ValueAnnotatedTypeFactory factory)
Finds the minimum value in a Value Checker type.
|
static org.checkerframework.common.value.util.Range |
getPossibleValues(org.checkerframework.framework.type.AnnotatedTypeMirror valueType,
org.checkerframework.common.value.ValueAnnotatedTypeFactory valueAnnotatedTypeFactory)
Returns a range representing the possible integral values represented by the passed
AnnotatedTypeMirror . |
static java.util.List<java.lang.String> |
getValueOfAnnotationWithStringArgument(javax.lang.model.element.AnnotationMirror anno)
Gets the value field of an annotation with a list of strings in its value field.
|
static boolean |
isSequenceType(javax.lang.model.type.TypeMirror type)
Determines whether the type is a sequence supported by this checker.
|
public static java.util.List<java.lang.String> getValueOfAnnotationWithStringArgument(javax.lang.model.element.AnnotationMirror anno)
For the Index Checker, this will get a list of array names from an Upper Bound or SameLen annotation. making this safe to call on any Upper Bound or SameLen annotation.
public static org.checkerframework.common.value.util.Range getPossibleValues(org.checkerframework.framework.type.AnnotatedTypeMirror valueType, org.checkerframework.common.value.ValueAnnotatedTypeFactory valueAnnotatedTypeFactory)
AnnotatedTypeMirror
. If the passed AnnotatedTypeMirror
does not contain an IntRange
annotation or an IntVal
annotation, returns null.public static java.lang.Long getExactValue(Tree tree, org.checkerframework.common.value.ValueAnnotatedTypeFactory factory)
public static java.lang.Long getMinValue(Tree tree, org.checkerframework.common.value.ValueAnnotatedTypeFactory factory)
public static java.lang.Long getMaxValue(Tree tree, org.checkerframework.common.value.ValueAnnotatedTypeFactory factory)
public static int getMinLen(Tree tree, org.checkerframework.common.value.ValueAnnotatedTypeFactory valueAnnotatedTypeFactory)
tree
. If not, returns 0.public static boolean isSequenceType(javax.lang.model.type.TypeMirror type)
public static ExpressionTree getLengthSequenceTree(Tree lengthTree, IndexMethodIdentifier imf, javax.annotation.processing.ProcessingEnvironment processingEnv)
public static java.lang.Integer getMinLenFromTree(Tree tree, org.checkerframework.common.value.ValueAnnotatedTypeFactory valueATF)