PsiElement () { PsiElement element = getPsiClass(); if (!(element instanceof PsiClass)) return element; PsiClass aClass = (PsiClass)getPsiClass(); if (!aClass.isValid()) return null; PsiMethod method = getMethod(aClass, false); if (method != null) return method; return aClass; }