From b82f3309b112874d39b9516daa9604d6508b210c Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 22 Nov 2016 15:33:16 +0300 Subject: [PATCH] cleanup --- .../codeInsight/daemon/impl/FileStatusMap.java | 2 +- .../daemon/impl/UpdateHighlightersUtil.java | 11 +++-------- .../openapi/editor/markup/RangeHighlighter.java | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java index 32e4ce7794fa..bca837742ed3 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java @@ -179,7 +179,7 @@ public class FileStatusMap implements Disposable { public void markFileUpToDate(@NotNull Document document, int passId) { synchronized(myDocumentToStatusMap){ - FileStatus status = myDocumentToStatusMap.computeIfAbsent(document, k -> new FileStatus(myProject)); + FileStatus status = myDocumentToStatusMap.computeIfAbsent(document, __ -> new FileStatus(myProject)); status.defensivelyMarked=false; if (passId == Pass.WOLF) { status.wolfPassFinished = true; diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/UpdateHighlightersUtil.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/UpdateHighlightersUtil.java index b93d2f029a3e..78235b301ede 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/UpdateHighlightersUtil.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/UpdateHighlightersUtil.java @@ -236,8 +236,7 @@ public class UpdateHighlightersUtil { final SeverityRegistrar severityRegistrar = SeverityRegistrar.getSeverityRegistrar(project); final HighlightersRecycler infosToRemove = new HighlightersRecycler(); - DaemonCodeAnalyzerEx - .processHighlights(document, project, null, range.getStartOffset(), range.getEndOffset(), info -> { + DaemonCodeAnalyzerEx.processHighlights(document, project, null, range.getStartOffset(), range.getEndOffset(), info -> { if (info.getGroup() == group) { RangeHighlighter highlighter = info.highlighter; int hiStart = highlighter.getStartOffset(); @@ -409,13 +408,9 @@ public class UpdateHighlightersUtil { return layer; } + @NotNull private static RangeMarker getOrCreate(@NotNull Document document, @NotNull Map ranges2markersCache, @NotNull TextRange textRange) { - RangeMarker marker = ranges2markersCache.get(textRange); - if (marker == null) { - marker = document.createRangeMarker(textRange); - ranges2markersCache.put(textRange, marker); - } - return marker; + return ranges2markersCache.computeIfAbsent(textRange, __ -> document.createRangeMarker(textRange)); } private static final Key TYPING_INSIDE_HIGHLIGHTER_OCCURRED = Key.create("TYPING_INSIDE_HIGHLIGHTER_OCCURRED"); diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java index a0a8372eff42..21737556aed8 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java @@ -122,7 +122,7 @@ public interface RangeHighlighter extends RangeMarker { void setErrorStripeMarkColor(@Nullable Color color); /** - * Returns the object whose toString() method is called to get the text of the tooltip + * Returns the object whose {@code toString()} method is called to get the text of the tooltip * for the error stripe marker added by the highlighter. * * @return the error stripe tooltip objects, or null if the highlighter does not add any error @@ -132,7 +132,7 @@ public interface RangeHighlighter extends RangeMarker { Object getErrorStripeTooltip(); /** - * Sets the object whose toString() method is called to get the text of the tooltip + * Sets the object whose {@code toString()} method is called to get the text of the tooltip * for the error stripe marker added by the highlighter. * * @param tooltipObject the error stripe tooltip objects, or null if the highlighter does not