public static int getMethodStubIndex(PsiMethod method) {
    if (!(method instanceof PsiMethodImpl)) return -1;
    PsiFileImpl file = (PsiFileImpl)method.getContainingFile();
    StubbedSpine spine = file.getStubbedSpine();

    int result = 0;
    for (int i = 0; i < spine.getStubCount(); i++) {
      if (spine.getStubType(i) == JavaElementType.METHOD) {
        if (spine.getStubPsi(i) == method) {
          return result;
        }
        result++;
      }
    }
    return -1;
  }
public static int getMethodStubIndex(PsiMethod method)