cleanup
authorAlexey Kudravtsev <cdr@intellij.com>
Tue, 20 Apr 2021 16:11:30 +0000 (18:11 +0200)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Wed, 21 Apr 2021 12:34:04 +0000 (15:34 +0300)
GitOrigin-RevId: bd8ea558fcd8e08bd790bd39ca29a2dfa213e61f

platform/lang-api/src/com/intellij/codeInsight/daemon/MergeableLineMarkerInfo.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LineMarkersPass.java

index 30dabe6ac0af72697b09e97aec7ca249ba60633c..206c6b125407f33a5459c49f9aa096ec584f8369 100644 (file)
@@ -43,7 +43,7 @@ public abstract class MergeableLineMarkerInfo<T extends PsiElement> extends Line
   public MergeableLineMarkerInfo(@NotNull T element,
                                  @NotNull TextRange textRange,
                                  Icon icon,
-                                 int updatePass,
+                                 int __,
                                  @Nullable Function<? super T, String> tooltipProvider,
                                  @Nullable GutterIconNavigationHandler<T> navHandler,
                                  @NotNull GutterIconRenderer.Alignment alignment) {
@@ -100,7 +100,7 @@ public abstract class MergeableLineMarkerInfo<T extends PsiElement> extends Line
     return GutterIconRenderer.Alignment.LEFT;
   }
 
-  public Supplier<@NotNull @Nls String> getCommonAccessibleNameProvider(@NotNull List<? extends MergeableLineMarkerInfo<?>> infos) {
+  private static Supplier<@NotNull @Nls String> getCommonAccessibleNameProvider(@NotNull List<? extends MergeableLineMarkerInfo<?>> infos) {
     return infos.get(0).getAccessibleNameProvider();
   }
 
@@ -119,16 +119,8 @@ public abstract class MergeableLineMarkerInfo<T extends PsiElement> extends Line
         MergeableLineMarkerInfo<?> current = markers.get(k);
         boolean canMergeWith = marker.canMergeWith(current);
         if (ApplicationManager.getApplication().isUnitTestMode() && !canMergeWith && current.canMergeWith(marker)) {
-          LOG.error(current.getClass() +
-                    "[" +
-                    current.getLineMarkerTooltip() +
-                    "]" +
-                    " can merge " +
-                    marker.getClass() +
-                    "[" +
-                    marker.getLineMarkerTooltip() +
-                    "]" +
-                    ", but not contrariwise");
+          LOG.error(current.getClass() + "[" + current.getLineMarkerTooltip() + "] can merge " +
+                    marker.getClass() + "[" + marker.getLineMarkerTooltip() + "], but not vice versa");
         }
         if (canMergeWith) {
           toMerge.add(0, current);
@@ -154,7 +146,7 @@ public abstract class MergeableLineMarkerInfo<T extends PsiElement> extends Line
     private MyLineMarkerInfo(@NotNull List<? extends MergeableLineMarkerInfo<?>> markers, @NotNull MergeableLineMarkerInfo<?> template) {
       //noinspection ConstantConditions
       super(template.getElement(), getCommonTextRange(markers), template.getCommonIcon(markers),
-            template.getCommonAccessibleNameProvider(markers), template.getCommonTooltip(markers),
+            getCommonAccessibleNameProvider(markers), template.getCommonTooltip(markers),
             getCommonNavigationHandler(markers), template.getCommonIconAlignment(markers));
     }
 
index a6bcac24e3c02face7b5b1139cd5fa5d00ac7a39..5811ff6645ff8f408fcf78bc48a87d765d020e8e 100644 (file)
@@ -100,14 +100,12 @@ public class LineMarkersPass extends TextEditorHighlightingPass {
 
   @NotNull
   private static List<LineMarkerInfo<?>> mergeLineMarkers(@NotNull List<LineMarkerInfo<?>> markers, @NotNull Document document) {
-    List<MergeableLineMarkerInfo<?>> forMerge = new ArrayList<>();
     TIntObjectHashMap<List<MergeableLineMarkerInfo<?>>> sameLineMarkers = new TIntObjectHashMap<>();
 
     for (int i = markers.size() - 1; i >= 0; i--) {
       LineMarkerInfo<?> marker = markers.get(i);
       if (marker instanceof MergeableLineMarkerInfo) {
         MergeableLineMarkerInfo<?> mergeable = (MergeableLineMarkerInfo<?>)marker;
-        forMerge.add(mergeable);
         markers.remove(i);
 
         int line = document.getLineNumber(marker.startOffset);
@@ -120,7 +118,7 @@ public class LineMarkersPass extends TextEditorHighlightingPass {
       }
     }
 
-    if (forMerge.isEmpty()) return markers;
+    if (sameLineMarkers.isEmpty()) return markers;
 
     List<LineMarkerInfo<?>> result = new ArrayList<>(markers);