AccessibilityLevel (@NotNull PsiElement element, @NotNull ProximityLocation location) { if (element instanceof PsiDocCommentOwner member) { PsiElement position = location.getPosition(); Project project = location.getProject(); if (project != null && !DumbService.isDumb(project)) { if (position != null && !JavaPsiFacade.getInstance(project).getResolveHelper().isAccessible(member, position, null)) { return AccessibilityLevel.INACCESSIBLE; } if (JavaCompletionUtil.isEffectivelyDeprecated(member)) return AccessibilityLevel.DEPRECATED; if (AnnotationUtil.isAnnotated(member, Arrays.asList(StaticAnalysisAnnotationManager.getInstance().getKnownUnstableApiAnnotations()), 0)) { return AccessibilityLevel.DISCOURAGED; } } if (member instanceof PsiClass) { PsiFile file = member.getContainingFile(); if (file instanceof PsiJavaFile) { String packageName = ((PsiJavaFile)file).getPackageName(); if (packageName.startsWith("com.sun.") || packageName.startsWith("sun.") || packageName.startsWith("org.omg.")) { return AccessibilityLevel.DISCOURAGED; } } if ("java.awt.List".equals(((PsiClass)member).getQualifiedName())) { return AccessibilityLevel.DISCOURAGED; } } } return AccessibilityLevel.NORMAL; }