From 55bbf46563e5e513d8da5ef632ede1fda9fe0e32 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 10 Nov 2014 18:42:44 +0100 Subject: [PATCH] cleanup --- .../openapi/roots/impl/storage/FileSet.java | 5 ++- .../eclipse/config/CachedXmlDocumentSet.java | 31 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/FileSet.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/FileSet.java index 335ee9d07aa0..bd3285f4446d 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/FileSet.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/FileSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.openapi.roots.impl.storage; import com.intellij.openapi.vfs.VirtualFile; @@ -29,5 +28,5 @@ public interface FileSet { void commit() throws IOException; - void listModifiedFiles(List list); + void listModifiedFiles(@NotNull List list); } diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java index d1ada931cf9d..ff1a13b1f286 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java @@ -22,7 +22,7 @@ import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.HashMap; +import gnu.trove.THashMap; import gnu.trove.THashSet; import org.jdom.Document; import org.jdom.JDOMException; @@ -31,27 +31,26 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.*; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; public class CachedXmlDocumentSet implements FileSet { - protected final Map nameToDir = new HashMap(); - protected final Map savedContent = new HashMap(); - protected final Map modifiedContent = new HashMap(); - protected final Set deletedContent = new HashSet(); + protected final Map nameToDir = new THashMap(); + protected final Map savedContent = new THashMap(); + protected final Map modifiedContent = new THashMap(); + protected final Set deletedContent = new THashSet(); private final Project project; public CachedXmlDocumentSet(Project project) { this.project = project; } - public Document read(final String name) throws IOException, JDOMException { + public Document read(@NotNull String name) throws IOException, JDOMException { return read(name, true); } - public Document read(final String name, final boolean refresh) throws IOException, JDOMException { + public Document read(@NotNull String name, final boolean refresh) throws IOException, JDOMException { return load(name, refresh).clone(); } @@ -59,15 +58,15 @@ public class CachedXmlDocumentSet implements FileSet { update(document.clone(), name); } - public String getParent(final String name) { + public String getParent(@NotNull String name) { return nameToDir.get(name); } - public void register(final String name, final String path) { + public void register(@NotNull String name, final String path) { nameToDir.put(name, path); } - protected void assertKnownName(final String name) { + protected void assertKnownName(@NotNull String name) { assert nameToDir.containsKey(name) : name; } @@ -77,12 +76,12 @@ public class CachedXmlDocumentSet implements FileSet { } @Nullable - protected VirtualFile getVFile(final String name) { + protected VirtualFile getVFile(@NotNull String name) { return getVFile(name, true); } @Nullable - protected VirtualFile getVFile(final String name, boolean refresh) { + protected VirtualFile getVFile(@NotNull String name, boolean refresh) { final VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(getParent(name), name)); if (file != null && refresh) { file.refresh(false, true); @@ -92,7 +91,7 @@ public class CachedXmlDocumentSet implements FileSet { } @NotNull - private VirtualFile getOrCreateVFile(final String name) throws IOException { + private VirtualFile getOrCreateVFile(@NotNull final String name) throws IOException { final VirtualFile vFile = getVFile(name); if (vFile != null) { return vFile; @@ -120,7 +119,7 @@ public class CachedXmlDocumentSet implements FileSet { } } - protected Document load(final String name, boolean refresh) throws IOException, JDOMException { + protected Document load(@NotNull String name, boolean refresh) throws IOException, JDOMException { assertKnownName(name); final Document logical = modifiedContent.get(name); if (logical != null) { @@ -197,7 +196,7 @@ public class CachedXmlDocumentSet implements FileSet { } @Override - public void listModifiedFiles(List list) { + public void listModifiedFiles(@NotNull List list) { for (String key : modifiedContent.keySet()) { try { if (hasChanged(key)) {