boolean (final PsiElement element) { if (element.getLanguage() != JavaLanguage.INSTANCE) return false; if (element instanceof PsiMethod method) { if (method.isConstructor() && !InlineUtil.isChainingConstructor(method)) { final PsiClass containingClass = method.getContainingClass(); if (containingClass == null) return false; return !hasInheritors(containingClass); } } if (!(element instanceof PsiClass psiClass)) return false; if (element instanceof PsiAnonymousClass) return false; if (hasInheritors(psiClass)) return false; boolean hasMembers = PsiTreeUtil.findChildOfType(psiClass, PsiMember.class) != null; return !hasMembers || !SealedUtils.hasSealedParent(psiClass); }