void (@NotNull PsiJavaCodeReferenceElement ref) { if (myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_9)) return;//javac 9 has no such bug if (ref.getParent() instanceof PsiTypeElement) { final PsiClass psiClass = PsiTreeUtil.getParentOfType(ref, PsiClass.class); if (psiClass == null) return; if (PsiTreeUtil.isAncestor(psiClass.getExtendsList(), ref, false) || PsiTreeUtil.isAncestor(psiClass.getImplementsList(), ref, false)) { final PsiElement qualifier = ref.getQualifier(); if (qualifier instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)qualifier).resolve() == psiClass) { final PsiJavaCodeReferenceElement referenceElement = PsiTreeUtil.getParentOfType(ref, PsiJavaCodeReferenceElement.class); if (referenceElement == null) return; final PsiElement typeClass = referenceElement.resolve(); if (!(typeClass instanceof PsiClass)) return; final PsiElement resolve = ref.resolve(); final PsiClass containingClass = resolve != null ? ((PsiClass)resolve).getContainingClass() : null; if (containingClass == null) return; PsiClass hiddenClass; if (psiClass.isInheritor(containingClass, true)) { hiddenClass = (PsiClass)resolve; } else { hiddenClass = unqualifiedNestedClassReferenceAccessedViaContainingClassInheritance((PsiClass)typeClass, ((PsiClass)resolve).getExtendsList()); if (hiddenClass == null) { hiddenClass = unqualifiedNestedClassReferenceAccessedViaContainingClassInheritance((PsiClass)typeClass, ((PsiClass)resolve).getImplementsList()); } } if (hiddenClass != null) { myHolder.registerProblem(ref, JavaErrorBundle.message("text.class.is.not.accessible", hiddenClass.getName())); } } } } }