PsiClass (@NotNull PsiElement element) { PsiClass topClass = JBIterable.generate(element, PsiElement::getParent).takeWhile(e -> !(e instanceof PsiFile)).filter(PsiClass.class).last(); return topClass instanceof PsiTypeParameter ? null : topClass; }