Class MoreASTHelpers

java.lang.Object
tech.picnic.errorprone.bugpatterns.util.MoreASTHelpers

public final class MoreASTHelpers extends Object
A collection of helper methods for working with the AST.

These methods are additions to the ones found in ASTHelpers.

  • 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 the VisitorState's current enclosing class.
      Parameters:
      methodName - The method name to search for.
      state - The VisitorState from 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 the VisitorState's current enclosing class.
      Parameters:
      methodName - The method name to search for.
      state - The VisitorState from which to derive the enclosing class of interest.
      Returns:
      Whether there are any methods with the given name in the enclosing class.