mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
foolproof null directory info caching
This commit is contained in:
@@ -41,6 +41,7 @@ import java.util.*;
|
||||
|
||||
class RootIndex {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.RootIndex");
|
||||
private static final DirectoryInfo NULL_INFO = DirectoryInfo.createNew();
|
||||
|
||||
private final Set<VirtualFile> myProjectExcludedRoots = ContainerUtil.newHashSet();
|
||||
private final Set<VirtualFile> myLibraryExcludedRoots = ContainerUtil.newHashSet();
|
||||
@@ -322,7 +323,7 @@ class RootIndex {
|
||||
}
|
||||
DirectoryInfo info = myInfoCache.get(root);
|
||||
if (info != null) {
|
||||
return info == DirectoryInfo.EMPTY ? null : info;
|
||||
return info == NULL_INFO ? null : info;
|
||||
}
|
||||
|
||||
info = myRoots.get(root);
|
||||
@@ -332,12 +333,12 @@ class RootIndex {
|
||||
}
|
||||
|
||||
if (isAnyExcludeRoot(root) || FileTypeManager.getInstance().isFileIgnored(root)) {
|
||||
myInfoCache.put(dir, DirectoryInfo.EMPTY);
|
||||
myInfoCache.put(dir, NULL_INFO);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
myInfoCache.put(dir, DirectoryInfo.EMPTY);
|
||||
myInfoCache.put(dir, NULL_INFO);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public final class DirectoryInfo {
|
||||
static final DirectoryInfo EMPTY = createNew();
|
||||
public static final int MAX_ROOT_TYPE_ID = (1 << (Byte.SIZE - 2)) - 1;
|
||||
private final Module module; // module to which content it belongs or null
|
||||
private final VirtualFile libraryClassRoot; // class root in library
|
||||
|
||||
Reference in New Issue
Block a user