Class IndexMethodIdentifier
- java.lang.Object
-
- org.checkerframework.checker.index.IndexMethodIdentifier
-
public class IndexMethodIdentifier extends java.lang.Object
Given a Tree or other construct, this class has methods to query whether it is a particular method call.
-
-
Constructor Summary
Constructors Constructor Description IndexMethodIdentifier(AnnotatedTypeFactory atypeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isIndexOfString(com.sun.source.tree.Tree methodTree)
Returns true iff the argument is an invocation of String#indexOf or String#lastIndexOf that takes a string parameter.boolean
isLengthOfMethodInvocation(com.sun.source.tree.Tree tree)
Returns true iftree
is an invocation of a method that returns the length of "this"boolean
isLengthOfMethodInvocation(javax.lang.model.element.ExecutableElement ele)
Returns true iftree
evaluates to the length of "this".boolean
isLengthOfMethodInvocation(Node node)
Returns true ifnode
is an invocation of a method that returns the length ofthis
boolean
isMathMax(com.sun.source.tree.Tree methodTree)
Returns true iff the argument is an invocation of Math.max.boolean
isMathMin(com.sun.source.tree.Tree methodTree)
Returns true iff the argument is an invocation of Math.min.boolean
isMathRandom(com.sun.source.tree.Tree tree, javax.annotation.processing.ProcessingEnvironment processingEnv)
Returns true iff the argument is an invocation of Math.random().boolean
isRandomNextDouble(com.sun.source.tree.Tree tree, javax.annotation.processing.ProcessingEnvironment processingEnv)
Returns true iff the argument is an invocation of Random.nextDouble().boolean
isRandomNextInt(com.sun.source.tree.Tree tree, javax.annotation.processing.ProcessingEnvironment processingEnv)
Returns true iff the argument is an invocation of Random.nextInt().
-
-
-
Constructor Detail
-
IndexMethodIdentifier
public IndexMethodIdentifier(AnnotatedTypeFactory atypeFactory)
-
-
Method Detail
-
isIndexOfString
public boolean isIndexOfString(com.sun.source.tree.Tree methodTree)
Returns true iff the argument is an invocation of String#indexOf or String#lastIndexOf that takes a string parameter.- Parameters:
methodTree
- the method invocation tree to be tested- Returns:
- true iff the argument is an invocation of one of String's indexOf or lastIndexOf methods that takes another string as a parameter
-
isMathMin
public boolean isMathMin(com.sun.source.tree.Tree methodTree)
Returns true iff the argument is an invocation of Math.min.- Parameters:
methodTree
- the method invocation tree to be tested- Returns:
- true iff the argument is an invocation of Math.min()
-
isMathMax
public boolean isMathMax(com.sun.source.tree.Tree methodTree)
Returns true iff the argument is an invocation of Math.max.
-
isMathRandom
public boolean isMathRandom(com.sun.source.tree.Tree tree, javax.annotation.processing.ProcessingEnvironment processingEnv)
Returns true iff the argument is an invocation of Math.random().
-
isRandomNextDouble
public boolean isRandomNextDouble(com.sun.source.tree.Tree tree, javax.annotation.processing.ProcessingEnvironment processingEnv)
Returns true iff the argument is an invocation of Random.nextDouble().
-
isRandomNextInt
public boolean isRandomNextInt(com.sun.source.tree.Tree tree, javax.annotation.processing.ProcessingEnvironment processingEnv)
Returns true iff the argument is an invocation of Random.nextInt().
-
isLengthOfMethodInvocation
public boolean isLengthOfMethodInvocation(com.sun.source.tree.Tree tree)
Returns true iftree
is an invocation of a method that returns the length of "this"- Parameters:
tree
- a tree- Returns:
- true if
tree
is an invocation of a method that returns the length ofthis
-
isLengthOfMethodInvocation
public boolean isLengthOfMethodInvocation(javax.lang.model.element.ExecutableElement ele)
Returns true iftree
evaluates to the length of "this". This might be a call to String,length, or a method annotated with @LengthOf.- Returns:
- true if
tree
evaluates to the length of "this"
-
isLengthOfMethodInvocation
public boolean isLengthOfMethodInvocation(Node node)
Returns true ifnode
is an invocation of a method that returns the length ofthis
- Parameters:
node
- a node- Returns:
- true if
node
is an invocation of a method that returns the length ofthis
-
-