PsiMember (@Nullable PsiElement element) { if (element == null) return null; PsiMethod method = MethodUtils.getJavaMethodFromHeader(element); if (method != null) { if (!method.isConstructor()) return null; var containingClass = method.getContainingClass(); if (!isSuitableClass(containingClass)) return null; return method; } PsiClass containingClass = ClassUtils.getContainingClass(element); if (!isSuitableClass(containingClass)) return null; PsiElement lBrace = containingClass.getLBrace(); if (lBrace != null && element.getTextRange().getStartOffset() >= lBrace.getTextRange().getStartOffset()) return null; if (containingClass.getConstructors().length > 0) return null; return containingClass; }