From dd2580a028c928bccbb5f35fa776dfb34cf712bb Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 21 May 2015 14:15:45 +0300 Subject: [PATCH] cleanup --- .../vfs/impl/local/LocalFileSystemBase.java | 2 +- .../com/intellij/openapi/util/io/FileUtil.java | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java index bee1560dd742..2fcd802d4227 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java @@ -224,7 +224,7 @@ public abstract class LocalFileSystemBase extends LocalFileSystem { return FileUtil.normalize(path); } - private static boolean isAbsoluteFileOrDriveLetter(File file) { + private static boolean isAbsoluteFileOrDriveLetter(@NotNull File file) { String path = file.getPath(); if (SystemInfo.isWindows && path.length() == 2 && path.charAt(1) == ':') { // just drive letter. diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java index 49ec48a69a8a..7ad8343fc52d 100644 --- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java +++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java @@ -667,7 +667,7 @@ public class FileUtil extends FileUtilRt { if (path == null || path.isEmpty()) { return path; } - else if (".".equals(path)) { + if (".".equals(path)) { return ""; } @@ -677,7 +677,8 @@ public class FileUtil extends FileUtilRt { } StringBuilder result = new StringBuilder(path.length()); - int start = processRoot(path, result), dots = 0; + int start = processRoot(path, result); + int dots = 0; boolean separator = true; for (int i = start; i < path.length(); ++i) { @@ -720,7 +721,7 @@ public class FileUtil extends FileUtilRt { return result.toString(); } - private static int processRoot(String path, StringBuilder result) { + private static int processRoot(@NotNull String path, @NotNull StringBuilder result) { if (SystemInfo.isWindows && path.length() > 1 && path.charAt(0) == '/' && path.charAt(1) == '/') { result.append("//"); @@ -742,20 +743,18 @@ public class FileUtil extends FileUtilRt { return shareEnd; } - else if (path.length() > 0 && path.charAt(0) == '/') { + if (!path.isEmpty() && path.charAt(0) == '/') { result.append('/'); return 1; } - else if (path.length() > 2 && path.charAt(1) == ':' && path.charAt(2) == '/') { + if (path.length() > 2 && path.charAt(1) == ':' && path.charAt(2) == '/') { result.append(path, 0, 3); return 3; } - else { - return 0; - } + return 0; } - private static void processDots(StringBuilder result, int dots, int start) { + private static void processDots(@NotNull StringBuilder result, int dots, int start) { if (dots == 2) { int pos = -1; if (!StringUtil.endsWith(result, "/../") && !StringUtil.equals(result, "../")) {