boolean (@NotNull final Project project, final @NotNull Editor editor, @NotNull PsiElement element) { if (element instanceof PsiIdentifier || element instanceof PsiJavaCodeReferenceElement || element instanceof PsiJavaModuleReferenceElement) { PsiElement targetElement = PsiTreeUtil.skipParentsOfType(element, PsiIdentifier.class, PsiJavaCodeReferenceElement.class, PsiJavaModuleReferenceElement.class); if (targetElement instanceof PsiVariable && PsiTreeUtil.isAncestor(((PsiVariable)targetElement).getInitializer(), element, false)) { return false; } if ( targetElement instanceof PsiClass aClass && PsiUtil.isLocalClass(aClass)) { return false; } if (targetElement instanceof PsiJavaDocumentedElement && !(targetElement instanceof PsiTypeParameter) && !(targetElement instanceof PsiAnonymousClass)) { return ((PsiJavaDocumentedElement)targetElement).getDocComment() == null; } if (targetElement instanceof PsiPackageStatement) { PsiFile file = targetElement.getContainingFile(); return PackageUtil.isPackageInfoFile(file) && JavaDocumentationProvider.getPackageInfoComment(file) == null; } else if (PackageUtil.isPackageInfoFile(targetElement)) { return JavaDocumentationProvider.getPackageInfoComment(targetElement) == null; } } return false; }