boolean (@NotNull PsiElement element) { Project project = element.getProject(); JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); if (element instanceof PsiMethod && isAddMainsEnabled() && PsiClassImplUtil.isMainOrPremainMethod((PsiMethod)element)) { return true; } if (element instanceof PsiClass aClass) { PsiClass applet = psiFacade.findClass("java.applet.Applet", GlobalSearchScope.allScope(project)); if (isAddAppletEnabled() && applet != null && aClass.isInheritor(applet, true)) { return true; } PsiClass servlet = psiFacade.findClass("javax.servlet.Servlet", GlobalSearchScope.allScope(project)); if (isAddServletEnabled() && servlet != null && aClass.isInheritor(servlet, true)) { return true; } if (isAddMainsEnabled() && hasMainMethodDeep(aClass)) return true; } if (element instanceof PsiModifierListOwner) { EntryPointsManager entryPointsManager = EntryPointsManager.getInstance(project); if (entryPointsManager.isEntryPoint(element)) return true; } for (EntryPoint extension : getExtensions()) { if (extension.isSelected() && extension.isEntryPoint(element)) { return true; } } return RefUtil.isImplicitUsage(element); }