PsiMethod (@Nullable PsiElement element) { PsiMethod method = MethodUtils.getJavaMethodFromHeader(element); if (method != null && method.isConstructor()) { PsiClass aClass = method.getContainingClass(); if (aClass != null && !aClass.isEnum() && method.getName().equals(aClass.getName())) { return method; } } return null; }