From 8bbe5d55d7d1b04bf53506715d88637df4a66a7d Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 1 Aug 2016 18:51:13 +0300 Subject: [PATCH] cleanup --- .../codeInsight/navigation/RunLineMarkerTest.java | 8 +++----- .../openapi/editor/markup/MarkupEditorFilter.java | 7 ++----- .../src/com/intellij/util/text/CharArrayCharSequence.java | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java index 7dc98e6f2636..0bcaf8224a93 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java @@ -23,7 +23,6 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.editor.markup.GutterIconRenderer; import com.intellij.testFramework.TestActionEvent; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import java.util.List; @@ -32,9 +31,7 @@ import java.util.Set; /** * @author Dmitry Avdeev */ -@SuppressWarnings("ConstantConditions") public class RunLineMarkerTest extends LightCodeInsightFixtureTestCase { - public void testRunLineMarker() throws Exception { myFixture.configureByText("MainTest.java", "public class MainTest {\n" + " public static void foo(String[] args) {\n" + @@ -43,7 +40,8 @@ public class RunLineMarkerTest extends LightCodeInsightFixtureTestCase { " }\n" + "}"); assertEquals(0, myFixture.findGuttersAtCaret().size()); - assertEquals(2, myFixture.findAllGutters().size()); + List gutters = myFixture.findAllGutters(); + assertEquals(2, gutters.size()); } public void testTestClassWithMain() throws Exception { @@ -77,7 +75,7 @@ public class RunLineMarkerTest extends LightCodeInsightFixtureTestCase { GutterIconsConfigurable configurable = new GutterIconsConfigurable(); configurable.createComponent(); List descriptors = configurable.getDescriptors(); - Set strings = ContainerUtil.map2Set(descriptors, descriptor -> descriptor.getId()); + Set strings = ContainerUtil.map2Set(descriptors, GutterIconDescriptor::getId); assertEquals(descriptors.size(), strings.size()); } } diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/MarkupEditorFilter.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/MarkupEditorFilter.java index 9890998a4706..3c8bad451a64 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/MarkupEditorFilter.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/MarkupEditorFilter.java @@ -24,12 +24,9 @@ import com.intellij.openapi.editor.Editor; * @author max * @see RangeHighlighter#setEditorFilter(MarkupEditorFilter) */ +@FunctionalInterface public interface MarkupEditorFilter { - MarkupEditorFilter EMPTY = new MarkupEditorFilter() { - public boolean avaliableIn(Editor editor) { - return true; - } - }; + MarkupEditorFilter EMPTY = editor -> true; /** * Checks if the highlighter is active in the specified editor. diff --git a/platform/util/src/com/intellij/util/text/CharArrayCharSequence.java b/platform/util/src/com/intellij/util/text/CharArrayCharSequence.java index b61401a5e9de..0557c9da5505 100644 --- a/platform/util/src/com/intellij/util/text/CharArrayCharSequence.java +++ b/platform/util/src/com/intellij/util/text/CharArrayCharSequence.java @@ -64,7 +64,7 @@ public class CharArrayCharSequence implements CharSequenceBackedByArray, CharSeq public char[] getChars() { if (myStart == 0) return myChars; char[] chars = new char[length()]; - System.arraycopy(myChars, myStart, chars, 0, length()); + getChars(chars, 0); return chars; }