From 2df193d143dd5104bd76eb96578d2da8ecb021e5 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 21 Sep 2017 20:12:42 +0300 Subject: [PATCH] cleanup --- .../configuration/libraryEditor/LibraryTreeStructure.java | 8 ++++---- .../libraries/ui/LibraryRootsComponentDescriptor.java | 1 - .../openapi/vfs/newvfs/persistent/PersistentFSImpl.java | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTreeStructure.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTreeStructure.java index dcf470db4432..da71a5d1cace 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTreeStructure.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTreeStructure.java @@ -30,12 +30,12 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -public class LibraryTreeStructure extends AbstractTreeStructure { +class LibraryTreeStructure extends AbstractTreeStructure { private final NodeDescriptor myRootElementDescriptor; private final LibraryRootsComponent myParentEditor; private final LibraryRootsComponentDescriptor myComponentDescriptor; - public LibraryTreeStructure(LibraryRootsComponent parentElement, LibraryRootsComponentDescriptor componentDescriptor) { + LibraryTreeStructure(LibraryRootsComponent parentElement, LibraryRootsComponentDescriptor componentDescriptor) { myParentEditor = parentElement; myComponentDescriptor = componentDescriptor; myRootElementDescriptor = new NodeDescriptor(null, null) { @@ -60,7 +60,7 @@ public class LibraryTreeStructure extends AbstractTreeStructure { public Object[] getChildElements(Object element) { final LibraryEditor libraryEditor = myParentEditor.getLibraryEditor(); if (element == myRootElementDescriptor) { - ArrayList elements = new ArrayList<>(3); + List elements = new ArrayList<>(3); for (OrderRootType type : myComponentDescriptor.getRootTypes()) { final String[] urls = libraryEditor.getUrls(type); if (urls.length > 0) { @@ -77,9 +77,9 @@ public class LibraryTreeStructure extends AbstractTreeStructure { if (element instanceof OrderRootTypeElement) { OrderRootTypeElement rootTypeElement = (OrderRootTypeElement)element; OrderRootType orderRootType = rootTypeElement.getOrderRootType(); - ArrayList items = new ArrayList<>(); final String[] urls = libraryEditor.getUrls(orderRootType).clone(); Arrays.sort(urls, LibraryRootsComponent.ourUrlComparator); + List items = new ArrayList<>(urls.length); for (String url : urls) { items.add(new ItemElement(rootTypeElement, url, orderRootType, libraryEditor.isJarDirectory(url, orderRootType), libraryEditor.isValid(url, orderRootType))); } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/LibraryRootsComponentDescriptor.java b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/LibraryRootsComponentDescriptor.java index fd75cc346846..0a40cfd71bca 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/LibraryRootsComponentDescriptor.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/LibraryRootsComponentDescriptor.java @@ -64,7 +64,6 @@ public abstract class LibraryRootsComponentDescriptor { /** * @return descriptor for the file chooser which will be shown when 'Attach Files' button is pressed - * @param libraryName */ @NotNull public FileChooserDescriptor createAttachFilesChooserDescriptor(@Nullable String libraryName) { diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java index 997c39e66d00..2c5dbd2158a9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java @@ -694,7 +694,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone // E.g. "change(a/b/c/x.txt)" and "delete(a/b/c)" are conflicting because "a/b/c/x.txt" is under the "a/b/c" directory from the other event. // // returns index after the last grouped event. - private static int groupByPath(@NotNull List inEvents, int startIndex, Set files, Set middleDirs) { + private static int groupByPath(@NotNull List inEvents, int startIndex, @NotNull Set files, @NotNull Set middleDirs) { // store all paths from all events (including all parents) // check the each new event's path against this set and if it's there, this event is conflicting @@ -729,7 +729,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone return i; } - private static boolean checkIfConflictingEvent(String path, Set files, Set middleDirs) { + private static boolean checkIfConflictingEvent(@NotNull String path, @NotNull Set files, @NotNull Set middleDirs) { if (!files.add(path) || middleDirs.contains(path)) { // conflicting event found for (non-strict) descendant, stop return true; @@ -758,7 +758,8 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone int startIndex, @NotNull List outApplyEvents, @NotNull List outValidatedEvents, - @NotNull Set files, @NotNull Set middleDirs) { + @NotNull Set files, + @NotNull Set middleDirs) { int endIndex = groupByPath(events, startIndex, files, middleDirs); // since all events in the group are mutually non-conflicting, we can re-arrange creations/deletions together groupCreations(events, startIndex, endIndex, outValidatedEvents, outApplyEvents);