boolean (PsiClass aSuper, String className, Set<? super PsiClass> alreadyVisited) { if (aSuper == null) { return false; } if (alreadyVisited.contains(aSuper)) { return false; } alreadyVisited.add(aSuper); final String superName = aSuper.getName(); if (className.equals(superName)) { return true; } final PsiClass[] supers = aSuper.getSupers(); for (PsiClass aSupers : supers) { if (hasMatchingName(aSupers, className, alreadyVisited)) { return true; } } return false; }