boolean (@NotNull final RefManager manager, @NotNull final GlobalJavaInspectionContext globalContext, @NotNull final ProblemDescriptionsProcessor problemsProcessor) { for (RefElement entryPoint : globalContext.getEntryPointsManager(manager).getEntryPoints(manager)) { problemsProcessor.ignoreElement(entryPoint); } manager.iterate(new RefJavaVisitor() { @Override public void visitMethod(@NotNull final RefMethod refMethod) { if (problemsProcessor.getDescriptions(refMethod) == null) return; if (!refMethod.isStatic() && !PsiModifier.PRIVATE.equals(refMethod.getAccessModifier()) && !(refMethod instanceof RefImplicitConstructor)) { globalContext.enqueueDerivedMethodsProcessor(refMethod, derivedMethod -> { ((RefElementImpl)refMethod).setFlag(false, CanBeFinalAnnotator.CAN_BE_FINAL_MASK); problemsProcessor.ignoreElement(refMethod); return false; }); } } @Override public void visitClass(@NotNull final RefClass refClass) { if (problemsProcessor.getDescriptions(refClass) == null) return; if (!refClass.isAnonymous() && !PsiModifier.PRIVATE.equals(refClass.getAccessModifier())) { globalContext.enqueueDerivedClassesProcessor(refClass, inheritor -> { ((RefClassImpl)refClass).setFlag(false, CanBeFinalAnnotator.CAN_BE_FINAL_MASK); problemsProcessor.ignoreElement(refClass); return false; }); } } @Override public void visitField(@NotNull final RefField refField) { if (problemsProcessor.getDescriptions(refField) == null) return; if (PsiModifier.PRIVATE.equals(refField.getAccessModifier())) return; globalContext.enqueueFieldUsagesProcessor(refField, new GlobalJavaInspectionContext.UsagesProcessor() { @Override public boolean process(PsiReference psiReference) { PsiElement expression = psiReference.getElement(); if (expression instanceof PsiReferenceExpression && PsiUtil.isAccessedForWriting((PsiExpression)expression)) { ((RefFieldImpl)refField).setFlag(false, CanBeFinalAnnotator.CAN_BE_FINAL_MASK); problemsProcessor.ignoreElement(refField); return false; } return true; } }); } }); return false; }