Class TreePathUtil
java.lang.Object
org.checkerframework.afu.annotator.scanner.TreePathUtil
Utility methods relating to TreePaths.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TreePathfindCountingContext(TreePath path) Returns the counting context for new, typecast, instanceof, and locals.static TreePathfindEnclosingClass(TreePath path) Returns the enclosing class.static TreePathstatic TreePathfindEnclosingInitBlock(TreePath path, boolean isStatic) static TreePathstatic TreePathfindEnclosingMethod(TreePath path) Returns the enclosing method.static TreePathstatic StringgetBinaryName(TreePath path) Given a TreePath, returns the binary name of the class it references.static booleanhasClassKind(Tree tree) static booleanReturns true if the given class contains some constructor.static booleanisFieldInit(TreePath path) Returns true if this is a field initialization.static booleanisInitBlock(TreePath path) static booleanisInitBlock(TreePath path, boolean isStatic) static booleanisInstanceInit(TreePath path) static booleanisStaticInit(TreePath path)
-
Method Details
-
hasClassKind
-
findCountingContext
Returns the counting context for new, typecast, instanceof, and locals.- Parameters:
path- a path to a method or a field/instance/static initializer- Returns:
- the counting context for new, typecast, instanceof, and locals
-
findEnclosingClass
Returns the enclosing class.- Parameters:
path- a tree path- Returns:
- the enclosing class
-
findEnclosingMethod
Returns the enclosing method.- Parameters:
path- a tree path- Returns:
- the enclosing method
-
isFieldInit
Returns true if this is a field initialization.- Parameters:
path- a tree path- Returns:
- true if this is a field initialization
-
findEnclosingFieldInit
-
isInitBlock
-
isInitBlock
-
findEnclosingInitBlock
-
isStaticInit
-
findEnclosingStaticInit
-
isInstanceInit
-
findEnclosingInstanceInit
-
hasConstructor
Returns true if the given class contains some constructor.- Parameters:
ct- a class- Returns:
- true if the given class contains some constructor
-
getBinaryName
Given a TreePath, returns the binary name of the class it references. Does not give the right name for anonymous classes, including those defined within methods.- Parameters:
path- a path to a class definition- Returns:
- the binary name of the class
-