private static boolean shouldStopAt(PsiElement e) {
    if (e instanceof PsiMethod || e instanceof PsiClass && !(e instanceof PsiTypeParameter)) return true;
    if (e instanceof PsiField) return Registry.is("ide.structural.navigation.visit.fields");
    return e instanceof PsiJavaToken && e.getParent() instanceof PsiClass && e.textMatches("}");
  }
private static boolean shouldStopAt(PsiElement e)