From 8316f58e65b7c231b0fcd4f6c9c889e33dc6fccc Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 31 Aug 2023 14:23:20 +0200 Subject: [PATCH] cleanup: reduce garbage GitOrigin-RevId: d32854e3e603db6d27b9d4f89516533e23c3bcb3 --- .../codeInsight/daemon/impl/InspectionRunner.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java index f964781ba34b..d8180ca64c8d 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java @@ -137,7 +137,7 @@ class InspectionRunner { afterOutsideProcessedCallback.accept(context); }; visitElements(session, init, outside, false, finalPriorityRange, TOMB_STONE, afterOutside, foundInjected, injectedContexts, - toolWrappers, empty(), enabledToolsPredicate); + toolWrappers, empty, enabledToolsPredicate); reportIdsOfInspectionsReportedAnyProblemToFUS(init); boolean isWholeFileInspectionsPass = !init.isEmpty() && init.get(0).tool.runForWholeFile(); @@ -177,7 +177,7 @@ class InspectionRunner { private @NotNull InspectionContext createTombStone() { LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(new LocalInspectionEP()); - InspectionProblemHolder holder = new InspectionProblemHolder(myPsiFile, tool, false, myInspectionProfileWrapper, empty()); + InspectionProblemHolder holder = new InspectionProblemHolder(myPsiFile, tool, false, myInspectionProfileWrapper, empty); return new InspectionContext(tool, holder, new PsiElementVisitor() {}); } @@ -265,12 +265,12 @@ class InspectionRunner { List wrappers = Collections.singletonList(new LocalInspectionToolWrapper(localTool)); InspectionRunner runner = new InspectionRunner(myPsiFile, myRestrictRange, myPriorityRange, myInspectInjected, true, myProgress, false, myInspectionProfileWrapper, mySuppressedElements); - result.addAll(runner.inspect(wrappers, HighlightSeverity.WARNING, false, empty(), emptyCallback(), emptyCallback(), null)); + result.addAll(runner.inspect(wrappers, HighlightSeverity.WARNING, false, empty, emptyCallback, emptyCallback, null)); } - private static @NotNull Consumer emptyCallback() { return __ -> { }; } + private static final @NotNull Consumer emptyCallback = __ -> { }; - private static @NotNull BiPredicate empty() { return (_1, _2) -> true; } + private static final @NotNull BiPredicate empty = (_1, _2) -> true; private void visitElements(@NotNull LocalInspectionToolSession session, @NotNull List init, @@ -420,7 +420,7 @@ class InspectionRunner { myIgnoreSuppressed, myInspectionProfileWrapper, mySuppressedElements); List injectedContexts = injectedRunner.inspect( wrappers, session.getMinimumSeverity(), true, cc, - emptyCallback(), emptyCallback(), enabledToolsPredicate); + emptyCallback, emptyCallback, enabledToolsPredicate); outInjectedContexts.addAll(injectedContexts); } return true;