Class NewScanner

All Implemented Interfaces:
TreeVisitor<Void,Void>

public final class NewScanner extends CommonScanner
NewScanner scans the source tree and determines the index of a given new, where the i^th index corresponds to the i^th new, using 0-based indexing.
  • Method Details

    • indexOfNewTree

      public static int indexOfNewTree(TreePath origpath, Tree tree)
      Computes the index of the given new tree amongst all new trees inside its method, using 0-based indexing. The tree has to be either a NewClassTree or a NewArrayTree. If the tree is not in a method, then the index is computed
      Parameters:
      origpath - the path ending in the given cast tree
      tree - the cast tree to search for
      Returns:
      the index of the given cast tree
    • visitNewClass

      public Void visitNewClass(NewClassTree node, Void p)
      Specified by:
      visitNewClass in interface TreeVisitor<Void,Void>
      Overrides:
      visitNewClass in class TreeScanner<Void,Void>
    • visitNewArray

      public Void visitNewArray(NewArrayTree node, Void p)
      Specified by:
      visitNewArray in interface TreeVisitor<Void,Void>
      Overrides:
      visitNewArray in class TreeScanner<Void,Void>
    • debug

      @FormatMethod public static void debug(String fmt, Object... args)
      Output debugging information, if debugging is enabled.
      Parameters:
      fmt - a format string
      args - the arguments to the format string
    • addNewToMethod

      public static void addNewToMethod(String methodName, Integer offset)
      Register the location of a new instruction.
      Parameters:
      methodName - the name of the method that contains the new instruction
      offset - the offset of the new instruction
    • getMethodNewIndex

      public static Integer getMethodNewIndex(String methodName, Integer offset)