From e9ba43b999a1fa520ac0bc0fd1cbd329ee814218 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 30 Jan 2024 18:07:11 +0100 Subject: [PATCH] cleanup: notnull GitOrigin-RevId: b9f0a6733f75532e5a854d17ac7dbcf087319dd2 --- .../java/codeInsight/intention/BoundedWildcardFixTest.java | 3 ++- .../com/intellij/java/refactoring/InvertBooleanTest.java | 3 ++- .../daemon/quickFix/LightQuickFixParameterizedTestCase.java | 4 ++-- .../codeInsight/daemon/quickFix/LightQuickFixTestCase.java | 2 +- .../editorActions/IndentingBackspaceHandlerTest.java | 3 ++- .../highlighting/BraceHighlightingHandlerBlockCaretTest.java | 2 +- .../highlighting/BraceHighlightingHandlerTest.java | 2 +- .../codeInsight/highlighting/HeavyBraceHighlighterTest.java | 2 +- .../openapi/editor/actions/EditorMultiCaretActionTest.java | 3 ++- .../com/intellij/openapi/editor/actions/MatchBraceTest.java | 2 +- .../com/intellij/testFramework/FileBasedTestCaseHelper.java | 2 +- .../com/intellij/testFramework/FileBasedTestCaseHelperEx.java | 3 +++ 12 files changed, 19 insertions(+), 12 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/intention/BoundedWildcardFixTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/intention/BoundedWildcardFixTest.java index 79a63f9aac44..d748280378ad 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/intention/BoundedWildcardFixTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/intention/BoundedWildcardFixTest.java @@ -3,6 +3,7 @@ package com.intellij.java.codeInsight.intention; import com.intellij.codeInsight.daemon.LightIntentionActionTestCase; import com.intellij.refactoring.BaseRefactoringProcessor; +import org.jetbrains.annotations.NotNull; public class BoundedWildcardFixTest extends LightIntentionActionTestCase { @Override @@ -11,7 +12,7 @@ public class BoundedWildcardFixTest extends LightIntentionActionTestCase { } @Override - protected void doSingleTest(String fileSuffix, String testDataPath) { + protected void doSingleTest(@NotNull String fileSuffix, String testDataPath) { BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()-> super.doSingleTest(fileSuffix, testDataPath)); } } diff --git a/java/java-tests/testSrc/com/intellij/java/refactoring/InvertBooleanTest.java b/java/java-tests/testSrc/com/intellij/java/refactoring/InvertBooleanTest.java index 679fb0c192ec..450a7e0f8850 100644 --- a/java/java-tests/testSrc/com/intellij/java/refactoring/InvertBooleanTest.java +++ b/java/java-tests/testSrc/com/intellij/java/refactoring/InvertBooleanTest.java @@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiNamedElement; import com.intellij.refactoring.invertBoolean.InvertBooleanProcessor; import com.intellij.testFramework.TestDataPath; +import org.jetbrains.annotations.NotNull; @TestDataPath("$CONTENT_ROOT/testData/refactoring/invertBoolean/") public class InvertBooleanTest extends LightRefactoringParameterizedTestCase { @@ -45,7 +46,7 @@ public class InvertBooleanTest extends LightRefactoringParameterizedTestCase { } @Override - public String getFileSuffix(String beforeFile) { + public String getFileSuffix(@NotNull String beforeFile) { return !beforeFile.contains(AFTER_PREFIX) && !beforeFile.endsWith(CONFLICTS_SUFFIX) ? beforeFile : null; } } diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixParameterizedTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixParameterizedTestCase.java index 4f801806db11..8294e7f1f25a 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixParameterizedTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixParameterizedTestCase.java @@ -14,13 +14,13 @@ import org.junit.runner.RunWith; @RunWith(Parameterized.class) public abstract class LightQuickFixParameterizedTestCase extends LightQuickFixTestCase implements FileBasedTestCaseHelperEx { @Override - public String getRelativeBasePath() { + public @NotNull String getRelativeBasePath() { return getBasePath(); } @Nullable @Override - public String getFileSuffix(String fileName) { + public String getFileSuffix(@NotNull String fileName) { if (!fileName.startsWith(BEFORE_PREFIX)) return null; return fileName.substring(BEFORE_PREFIX.length()); } diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java index 0a2102ba7893..1d71ee26719e 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java @@ -215,7 +215,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase doTestFor(fileSuffix, createWrapper()); } - protected void doSingleTest(String fileSuffix, String testDataPath) { + protected void doSingleTest(@NotNull String fileSuffix, String testDataPath) { doTestFor(fileSuffix, createWrapper(testDataPath)); } diff --git a/platform/lang-impl/testSources/com/intellij/codeInsight/editorActions/IndentingBackspaceHandlerTest.java b/platform/lang-impl/testSources/com/intellij/codeInsight/editorActions/IndentingBackspaceHandlerTest.java index bcddb85912b7..9ae8898ddbed 100644 --- a/platform/lang-impl/testSources/com/intellij/codeInsight/editorActions/IndentingBackspaceHandlerTest.java +++ b/platform/lang-impl/testSources/com/intellij/codeInsight/editorActions/IndentingBackspaceHandlerTest.java @@ -18,6 +18,7 @@ package com.intellij.codeInsight.editorActions; import com.intellij.testFramework.FileBasedTestCaseHelper; import com.intellij.testFramework.LightPlatformCodeInsightTestCase; import com.intellij.testFramework.TestDataPath; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +35,7 @@ public class IndentingBackspaceHandlerTest extends LightPlatformCodeInsightTestC @Nullable @Override - public String getFileSuffix(String fileName) { + public String getFileSuffix(@NotNull String fileName) { return fileName.contains("-after.") ? null : fileName; } } \ No newline at end of file diff --git a/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerBlockCaretTest.java b/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerBlockCaretTest.java index fcf98c5fa979..585d4ddb0518 100644 --- a/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerBlockCaretTest.java +++ b/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerBlockCaretTest.java @@ -26,7 +26,7 @@ public class BraceHighlightingHandlerBlockCaretTest extends LightPlatformCodeIns @Nullable @Override - public String getFileSuffix(String fileName) { + public String getFileSuffix(@NotNull String fileName) { return StringUtil.endsWith(fileName, ".txt") ? null : fileName; } diff --git a/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerTest.java b/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerTest.java index ab743fd8a65b..6ac8b01ce8d1 100644 --- a/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerTest.java +++ b/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/BraceHighlightingHandlerTest.java @@ -35,7 +35,7 @@ public class BraceHighlightingHandlerTest extends LightPlatformCodeInsightTestCa @Nullable @Override - public String getFileSuffix(String fileName) { + public String getFileSuffix(@NotNull String fileName) { return StringUtil.endsWith(fileName, ".txt") ? null : fileName; } diff --git a/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/HeavyBraceHighlighterTest.java b/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/HeavyBraceHighlighterTest.java index 6bbd89912bac..b7b78254885a 100644 --- a/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/HeavyBraceHighlighterTest.java +++ b/platform/lang-impl/testSources/com/intellij/codeInsight/highlighting/HeavyBraceHighlighterTest.java @@ -38,7 +38,7 @@ public class HeavyBraceHighlighterTest extends LightPlatformCodeInsightTestCase } @Override - public @Nullable String getFileSuffix(String fileName) { + public @Nullable String getFileSuffix(@NotNull String fileName) { return StringUtil.endsWith(fileName, ".txt") ? null : fileName; } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java index 56cf5a0d8373..d1ea8587614c 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java @@ -16,6 +16,7 @@ package com.intellij.openapi.editor.actions; import com.intellij.testFramework.*; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Test; import org.junit.runner.RunWith; @@ -33,7 +34,7 @@ public class EditorMultiCaretActionTest extends LightPlatformCodeInsightTestCase @Nullable @Override - public String getFileSuffix(String fileName) { + public String getFileSuffix(@NotNull String fileName) { int pos = fileName.indexOf("-before."); if (pos < 0) { return null; diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/MatchBraceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/MatchBraceTest.java index 9b0d38bdb347..cd835ee25454 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/MatchBraceTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/MatchBraceTest.java @@ -39,7 +39,7 @@ public class MatchBraceTest extends LightPlatformCodeInsightTestCase implements @Nullable @Override - public String getFileSuffix(String fileName) { + public String getFileSuffix(@NotNull String fileName) { int pos = fileName.indexOf("-before."); if (pos < 0) { return null; diff --git a/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelper.java b/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelper.java index 842cd03d539b..8b241ee957df 100644 --- a/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelper.java +++ b/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelper.java @@ -33,7 +33,7 @@ public interface FileBasedTestCaseHelper { * @return for 'before' files should return core file name or null otherwise */ @Nullable - String getFileSuffix(String fileName); + String getFileSuffix(@NotNull String fileName); /** * @return for 'after' files should return core file name or null otherwise diff --git a/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelperEx.java b/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelperEx.java index f14df27643f6..c8f606a990e1 100644 --- a/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelperEx.java +++ b/platform/testFramework/src/com/intellij/testFramework/FileBasedTestCaseHelperEx.java @@ -16,9 +16,12 @@ package com.intellij.testFramework; +import org.jetbrains.annotations.NotNull; + public interface FileBasedTestCaseHelperEx extends FileBasedTestCaseHelper { /** * @return path related to the test data root according to {@link LightPlatformCodeInsightTestCase#getTestDataPath()} */ + @NotNull String getRelativeBasePath(); }