void (@NotNull PsiJavaCodeReferenceElement reference) { super.visitReferenceElement(reference); if (reference.isQualified()) { return; } final PsiElement target = reference.resolve(); if (!(target instanceof PsiClass aClass)) { return; } if (!aClass.hasModifierProperty(PsiModifier.STATIC) && reference.getParent() instanceof PsiNewExpression) { return; } final PsiClass containingClass = aClass.getContainingClass(); if (containingClass == null || containingClass instanceof PsiAnonymousClass) { return; } if (ignoreReferencesToLocalInnerClasses) { if (PsiTreeUtil.isAncestor(containingClass, reference, true)) { return; } final PsiClass referenceClass = PsiTreeUtil.getParentOfType(reference, PsiClass.class); if (referenceClass != null && referenceClass.isInheritor(containingClass, true)) { return; } } registerError(reference, containingClass.getName()); }