boolean (@NotNull final InspectionManager manager, @NotNull final GlobalInspectionContext globalContext, @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) { globalContext.getRefManager().iterate(new RefJavaVisitor() { @Override public void visitElement(@NotNull RefEntity refEntity) { final SmartPsiElementPointer<PsiClass> classPointer = refEntity.getUserData(MARKER); if (classPointer != null) { final Ref<PsiClass> ref = Ref.create(classPointer.getElement()); final GlobalJavaInspectionContext globalJavaContext = globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT); final GlobalJavaInspectionContext.UsagesProcessor processor = new GlobalJavaInspectionContext.UsagesProcessor() { @Override public boolean process(PsiReference reference) { final PsiClass containingClass = ClassUtils.getContainingClass(reference.getElement()); if (containingClass == null) return false; if (problemDescriptionsProcessor.getDescriptions(refEntity) != null) { if (containingClass != ref.get()) { problemDescriptionsProcessor.ignoreElement(refEntity); return false; } } else { final UElement anchor = refEntity instanceof RefMethod ? ((RefMethod)refEntity).getUastElement().getUastAnchor() : ((RefField)refEntity).getUastElement().getUastAnchor(); if (anchor == null) return false; if (isInGeneratedSource(containingClass)) return false; final PsiElement identifier = anchor.getSourcePsi(); final ProblemDescriptor problemDescriptor = createProblemDescriptor(manager, identifier, containingClass); problemDescriptionsProcessor.addProblemElement(refEntity, problemDescriptor); ref.set(containingClass); } return true; } }; if (refEntity instanceof RefMethod refMethod) { globalJavaContext.enqueueMethodUsagesProcessor(refMethod, processor); } else if (refEntity instanceof RefField refField) { globalJavaContext.enqueueFieldUsagesProcessor(refField, processor); } } } }); return false; }