From 166bac588a58d86c5804613fc85b389fc669a337 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 31 May 2021 15:04:11 +0200 Subject: [PATCH] cleanup GitOrigin-RevId: 859c6e801073915585a5c85b875df430e26460fd --- .../hierarchy/CallHierarchyBrowserBase.java | 4 ++-- .../ExcludedFilesFormatterTest.java | 7 +++--- .../vfs/local/LocalFileSystemTest.java | 2 +- .../intellij/openapi/util/io/IoTestUtil.java | 22 +++++++++---------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/hierarchy/CallHierarchyBrowserBase.java b/platform/lang-impl/src/com/intellij/ide/hierarchy/CallHierarchyBrowserBase.java index 6f4ddf5e0608..375da827a8e3 100644 --- a/platform/lang-impl/src/com/intellij/ide/hierarchy/CallHierarchyBrowserBase.java +++ b/platform/lang-impl/src/com/intellij/ide/hierarchy/CallHierarchyBrowserBase.java @@ -105,13 +105,13 @@ public abstract class CallHierarchyBrowserBase extends HierarchyBrowserBaseEx { } } - @SuppressWarnings("UnresolvedPropertyKey") public static @NotNull String getCalleeType() { + //noinspection UnresolvedPropertyKey return IdeBundle.message("title.hierarchy.callees.of"); } - @SuppressWarnings("UnresolvedPropertyKey") public static @NotNull String getCallerType() { + //noinspection UnresolvedPropertyKey return IdeBundle.message("title.hierarchy.callers.of"); } } \ No newline at end of file diff --git a/platform/platform-tests/testSrc/com/intellij/formatting/ExcludedFilesFormatterTest.java b/platform/platform-tests/testSrc/com/intellij/formatting/ExcludedFilesFormatterTest.java index 3f308d7a5399..0d61a8ac8ee0 100644 --- a/platform/platform-tests/testSrc/com/intellij/formatting/ExcludedFilesFormatterTest.java +++ b/platform/platform-tests/testSrc/com/intellij/formatting/ExcludedFilesFormatterTest.java @@ -24,7 +24,6 @@ import org.jetbrains.annotations.Nullable; import java.io.IOException; -@SuppressWarnings("SameParameterValue") public class ExcludedFilesFormatterTest extends FileSetTestCase { public static final String UNFORMATTED_SAMPLE = ""; @@ -59,7 +58,7 @@ public class ExcludedFilesFormatterTest extends FileSetTestCase { VirtualFile f2 = createFile("src/subdir/f2.xml", UNFORMATTED_SAMPLE); VirtualFile f3 = createFile("src/subdir/test/f3.xml", UNFORMATTED_SAMPLE); NamedScopesHolder localHolder = NamedScopeManager.getInstance(getProject()); - @SuppressWarnings("unused") NamedScope testScope = createScope(localHolder, "testScope", "file:*2.xml"); + createScope(localHolder, "testScope", "file:*2.xml"); CodeStyle.getSettings(getProject()).getExcludedFiles().addDescriptor(new NamedScopeDescriptor("testScope")); try { formatProjectFiles(false, false); @@ -109,7 +108,7 @@ public class ExcludedFilesFormatterTest extends FileSetTestCase { assertFormatted(f3); } - private static NamedScope createScope(@NotNull NamedScopesHolder holder, @NotNull String name, @NotNull String pattern) + private static @NotNull NamedScope createScope(@NotNull NamedScopesHolder holder, @NotNull String name, @NotNull String pattern) throws ParsingException { PackageSet fileSet = PackageSetFactory.getInstance().compile(pattern); NamedScope scope = holder.createScope(name, fileSet); @@ -117,7 +116,7 @@ public class ExcludedFilesFormatterTest extends FileSetTestCase { return scope; } - private void addPatternExclusions(String... patterns) { + private void addPatternExclusions(String @NotNull ... patterns) { CodeStyleSettings settings = CodeStyle.getSettings(getProject()); for (String pattern : patterns) { settings.getExcludedFiles().addDescriptor(new GlobPatternDescriptor(pattern)); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java index efb90ff38501..02ec5aa5a550 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java @@ -714,7 +714,7 @@ public class LocalFileSystemTest extends BareTestFixtureTestCase { }); try { - files.forEach(f -> updateFile(new File(f.getPath()), "+++")); + files.forEach(f -> writeToFile(new File(f.getPath()), "+++")); ((NewVirtualFile)topDir).markDirtyRecursively(); RefreshSession session = RefreshQueue.getInstance().createSession(false, true, null); diff --git a/platform/testFramework/src/com/intellij/openapi/util/io/IoTestUtil.java b/platform/testFramework/src/com/intellij/openapi/util/io/IoTestUtil.java index 541dfbda5274..1b84cb0884d8 100644 --- a/platform/testFramework/src/com/intellij/openapi/util/io/IoTestUtil.java +++ b/platform/testFramework/src/com/intellij/openapi/util/io/IoTestUtil.java @@ -59,7 +59,7 @@ public final class IoTestUtil { return filterParts(Charset.forName(forEncoding).newEncoder()::canEncode); } - private static String filterParts(Predicate predicate) { + private static String filterParts(@NotNull Predicate predicate) { return StringUtil.nullize(Stream.of(UNICODE_PARTS).filter(predicate).collect(Collectors.joining("_"))); } @@ -70,7 +70,8 @@ public final class IoTestUtil { return dir; } - private static File expandWindowsPath(File file) { + @NotNull + private static File expandWindowsPath(@NotNull File file) { if (SystemInfo.isWindows && file.getPath().indexOf('~') > 0) { try { return file.getCanonicalFile(); @@ -98,8 +99,9 @@ public final class IoTestUtil { } } - private static File createSymLink(String target, String link, @Nullable Boolean shouldExist) { - File linkFile = getFullLinkPath(link), targetFile = new File(target); + private static @NotNull File createSymLink(String target, String link, @Nullable Boolean shouldExist) { + File linkFile = getFullLinkPath(link); + File targetFile = new File(target); try { if (symLinkMode == Boolean.TRUE) { Files.createSymbolicLink(linkFile.toPath(), targetFile.toPath()); @@ -206,7 +208,7 @@ public final class IoTestUtil { throw new RuntimeException("No free roots"); } - private static File getFullLinkPath(String link) { + private static @NotNull File getFullLinkPath(@NotNull String link) { File linkFile = new File(link); if (!linkFile.isAbsolute()) { linkFile = new File(getTempDirectory(), link); @@ -354,7 +356,7 @@ public final class IoTestUtil { } } - public static void delete(File... files) { + public static void delete(File @NotNull ... files) { for (File file : files) { if (file != null) { FileUtil.delete(file); @@ -362,7 +364,7 @@ public final class IoTestUtil { } } - public static void updateFile(@NotNull File file, String content) { + public static void writeToFile(@NotNull File file, @NotNull String content) { try { FileUtil.writeToFile(file, content); } @@ -382,8 +384,7 @@ public final class IoTestUtil { return Boolean.TRUE; } catch (IOException e) { - //noinspection RedundantSuppression - Logger.getInstance("#com.intellij.openapi.util.io.IoTestUtil").debug(e); + Logger.getInstance(IoTestUtil.class).debug(e); runCommand("cmd", "/C", "mklink", link.toString(), target.getFileName().toString()); return Boolean.FALSE; } @@ -397,8 +398,7 @@ public final class IoTestUtil { } } catch (Throwable t) { - //noinspection RedundantSuppression - Logger.getInstance("#com.intellij.openapi.util.io.IoTestUtil").debug(t); + Logger.getInstance(IoTestUtil.class).debug(t); return null; } }