Class MemberReferenceScanner

All Implemented Interfaces:
TreeVisitor<Void,Void>

public class MemberReferenceScanner extends CommonScanner
  • Method Details

    • indexOfMemberReferenceTree

      public static int indexOfMemberReferenceTree(TreePath origpath, Tree tree)
      Computes the index of the given method invocation amongst all method invocation trees inside its method, using 0-based indexing.
      Parameters:
      origpath - the path ending in the given method invocation tree
      tree - the method invocation tree to search for
      Returns:
      the index of the given method invocation tree
    • visitMemberReference

      public Void visitMemberReference(MemberReferenceTree node, Void p)
      Specified by:
      visitMemberReference in interface TreeVisitor<Void,Void>
      Overrides:
      visitMemberReference in class TreeScanner<Void,Void>
    • addMemberReferenceToMethod

      public static void addMemberReferenceToMethod(String methodName, Integer offset)
      Adds a member reference bytecode offset to the current list of offsets for methodName. This method must be called with monotonically increasing offsets for any one method.
      Parameters:
      methodName - the name of the method
      offset - the offset to add
    • getMemberReferenceIndex

      public static Integer getMemberReferenceIndex(String methodName, Integer offset)
      Returns the index of the given offset within the list of offsets for the given method, using 0-based indexing, or returns a negative number if the offset is not one of the offsets in the context.
      Parameters:
      methodName - the name of the method
      offset - the offset of the lambda expression
      Returns:
      the index of the given offset, or a negative number if the offset does not exist inside the context