Class MoreASTHelpers
java.lang.Object
tech.picnic.errorprone.bugpatterns.util.MoreASTHelpers
A collection of helper methods for working with the AST.
These methods are additions to the ones found in ASTHelpers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.collect.ImmutableList<MethodTree>findMethods(CharSequence methodName, com.google.errorprone.VisitorState state) Finds methods with the specified name in given theVisitorState's current enclosing class.static booleanmethodExistsInEnclosingClass(CharSequence methodName, com.google.errorprone.VisitorState state) Determines whether there are any methods with the specified name in given theVisitorState's current enclosing class.
-
Method Details
-
findMethods
public static com.google.common.collect.ImmutableList<MethodTree> findMethods(CharSequence methodName, com.google.errorprone.VisitorState state) Finds methods with the specified name in given theVisitorState's current enclosing class.- Parameters:
methodName- The method name to search for.state- TheVisitorStatefrom which to derive the enclosing class of interest.- Returns:
- The
MethodTrees of the methods with the given name in the enclosing class.
-
methodExistsInEnclosingClass
public static boolean methodExistsInEnclosingClass(CharSequence methodName, com.google.errorprone.VisitorState state) Determines whether there are any methods with the specified name in given theVisitorState's current enclosing class.- Parameters:
methodName- The method name to search for.state- TheVisitorStatefrom which to derive the enclosing class of interest.- Returns:
- Whether there are any methods with the given name in the enclosing class.
-