mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inlined getId
This commit is contained in:
@@ -152,17 +152,17 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
|
||||
VirtualFile parent = file.getParent();
|
||||
if (!(parent instanceof NewVirtualFile)) return;
|
||||
DirectoryInfo existing = myState.getInfo(getId(file));
|
||||
DirectoryInfo existing = myState.getInfo(((NewVirtualFile)file).getId());
|
||||
assert existing == null : file+" -> "+existing;
|
||||
myState = updateStateWithNewFile((NewVirtualFile)file, parent);
|
||||
myState = updateStateWithNewFile((NewVirtualFile)file, (NewVirtualFile)parent);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
private IndexState updateStateWithNewFile(@NotNull NewVirtualFile file, @NotNull VirtualFile parent) {
|
||||
private IndexState updateStateWithNewFile(@NotNull NewVirtualFile file, @NotNull NewVirtualFile parent) {
|
||||
final IndexState originalState = myState;
|
||||
IndexState state = originalState;
|
||||
int parentId = getId(parent);
|
||||
int parentId = parent.getId();
|
||||
DirectoryInfo parentInfo = originalState.getInfo(parentId);
|
||||
if (parentInfo != null) {
|
||||
assertAncestor(parentInfo, parent, parentId);
|
||||
@@ -184,7 +184,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
VirtualFile f = file.findFileByRelativePath(rel);
|
||||
if (f instanceof NewVirtualFile) {
|
||||
if (state == originalState) state = state.copy(null);
|
||||
state.fillMapWithModuleContent(f, eachModule, f, null);
|
||||
state.fillMapWithModuleContent((NewVirtualFile)f, eachModule, (NewVirtualFile)f, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,25 +201,25 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
|
||||
if (state == originalState) state = state.copy(null);
|
||||
VirtualFile parentContentRoot = parentInfo.getContentRoot();
|
||||
state.fillMapWithModuleContent(file, module, parentContentRoot, null);
|
||||
state.fillMapWithModuleContent(file, module, (NewVirtualFile)parentContentRoot, null);
|
||||
|
||||
String parentPackage = state.myDirToPackageName.get(parentId);
|
||||
|
||||
if (module != null) {
|
||||
if (parentInfo.isInModuleSource()) {
|
||||
String newDirPackageName = getPackageNameForSubdir(parentPackage, file.getName());
|
||||
state.fillMapWithModuleSource(module, parentContentRoot, file, newDirPackageName, parentInfo.getSourceRoot(), parentInfo.isTestSource(), null);
|
||||
state.fillMapWithModuleSource(module, (NewVirtualFile)parentContentRoot, file, newDirPackageName, (NewVirtualFile)parentInfo.getSourceRoot(), parentInfo.isTestSource(), null);
|
||||
}
|
||||
}
|
||||
|
||||
if (parentInfo.hasLibraryClassRoot()) {
|
||||
String newDirPackageName = getPackageNameForSubdir(parentPackage, file.getName());
|
||||
state.fillMapWithLibraryClasses(file, newDirPackageName, parentInfo.getLibraryClassRoot(), null);
|
||||
state.fillMapWithLibraryClasses(file, newDirPackageName, (NewVirtualFile)parentInfo.getLibraryClassRoot(), null);
|
||||
}
|
||||
|
||||
if (parentInfo.isInLibrarySource()) {
|
||||
String newDirPackageName = getPackageNameForSubdir(parentPackage, file.getName());
|
||||
state.fillMapWithLibrarySources(file, newDirPackageName, parentInfo.getSourceRoot(), null);
|
||||
state.fillMapWithLibrarySources(file, newDirPackageName, (NewVirtualFile)parentInfo.getSourceRoot(), null);
|
||||
}
|
||||
|
||||
OrderEntry[] entries = parentInfo.getOrderEntries();
|
||||
@@ -235,7 +235,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
public void beforeFileDeletion(VirtualFileEvent event) {
|
||||
VirtualFile file = event.getFile();
|
||||
if (!file.isDirectory()) return;
|
||||
if (myState.getInfo(getId(file)) == null) return;
|
||||
if (myState.getInfo(((NewVirtualFile)file).getId()) == null) return;
|
||||
|
||||
TIntArrayList list = new TIntArrayList();
|
||||
addDirsRecursively(myState, list, file);
|
||||
@@ -244,7 +244,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
|
||||
private void addDirsRecursively(@NotNull IndexState state, @NotNull TIntArrayList list, @NotNull VirtualFile dir) {
|
||||
if (!(dir instanceof NewVirtualFile)) return;
|
||||
int id = getId(dir);
|
||||
int id = ((NewVirtualFile)dir).getId();
|
||||
if (state.getInfo(id) == null) return;
|
||||
|
||||
list.add(id);
|
||||
@@ -323,7 +323,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
public boolean execute(@NotNull final Pair<IndexState, List<VirtualFile>> stateAndDirs,
|
||||
@NotNull final Processor<VirtualFile> consumer) {
|
||||
for (VirtualFile dir : stateAndDirs.second) {
|
||||
DirectoryInfo info = stateAndDirs.first.myDirToInfoMap.get(getId(dir));
|
||||
DirectoryInfo info = stateAndDirs.first.myDirToInfoMap.get(((NewVirtualFile)dir).getId());
|
||||
assert info != null;
|
||||
|
||||
if (!info.isInLibrarySource() || info.isInModuleSource() || info.hasLibraryClassRoot()) {
|
||||
@@ -446,14 +446,14 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
checkAvailability();
|
||||
dispatchPendingEvents();
|
||||
|
||||
if (!(dir instanceof VirtualFileWithId)) return null;
|
||||
return myState.getInfo(getId(dir));
|
||||
if (!(dir instanceof NewVirtualFile)) return null;
|
||||
return myState.getInfo(((NewVirtualFile)dir).getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProjectExcludeRoot(@NotNull VirtualFile dir) {
|
||||
checkAvailability();
|
||||
return dir instanceof VirtualFileWithId && myState.myProjectExcludeRoots.contains(getId(dir));
|
||||
return dir instanceof NewVirtualFile && myState.myProjectExcludeRoots.contains(((NewVirtualFile)dir).getId());
|
||||
}
|
||||
|
||||
private VirtualFile findFileById(int dir) {
|
||||
@@ -463,8 +463,8 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
@Override
|
||||
public String getPackageName(@NotNull VirtualFile dir) {
|
||||
checkAvailability();
|
||||
if (!(dir instanceof VirtualFileWithId)) return null;
|
||||
return myState.myDirToPackageName.get(getId(dir));
|
||||
if (!(dir instanceof NewVirtualFile)) return null;
|
||||
return myState.myDirToPackageName.get(((NewVirtualFile)dir).getId());
|
||||
}
|
||||
|
||||
private void checkAvailability() {
|
||||
@@ -594,11 +594,11 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
}
|
||||
}
|
||||
|
||||
void fillMapWithModuleContent(@NotNull VirtualFile root,
|
||||
void fillMapWithModuleContent(@NotNull NewVirtualFile root,
|
||||
final Module module,
|
||||
final VirtualFile contentRoot,
|
||||
final NewVirtualFile contentRoot,
|
||||
@Nullable final ProgressIndicator progress) {
|
||||
final int contentRootId = contentRoot == null ? 0 : getId(contentRoot);
|
||||
final int contentRootId = contentRoot == null ? 0 : contentRoot.getId();
|
||||
if (contentRoot != null) {
|
||||
assert VfsUtilCore.isAncestor(contentRoot, root, false) : "Root: "+root+"; contentRoot: "+contentRoot;
|
||||
}
|
||||
@@ -611,11 +611,11 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
if (isExcluded(contentRootId, file)) return null;
|
||||
if (isIgnored(file)) return null;
|
||||
|
||||
DirectoryInfo info = getOrCreateDirInfo(getId(file));
|
||||
DirectoryInfo info = getOrCreateDirInfo(((NewVirtualFile)file).getId());
|
||||
|
||||
if (info.getModule() != null) { // module contents overlap
|
||||
VirtualFile dir = file.getParent();
|
||||
DirectoryInfo parentInfo = dir == null ? null : getInfo(getId(dir));
|
||||
DirectoryInfo parentInfo = dir == null ? null : getInfo(((NewVirtualFile)dir).getId());
|
||||
if (parentInfo == null || !info.getModule().equals(parentInfo.getModule())) return null;
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
|
||||
@Override
|
||||
protected void afterChildrenVisited(@NotNull VirtualFile file, @NotNull DirectoryInfo info) {
|
||||
with(getId(file), info, module, contentRoot, null, null, 0, null);
|
||||
with(((NewVirtualFile)file).getId(), info, module, contentRoot, null, null, 0, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -641,10 +641,10 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
if (contentRoot != null) {
|
||||
assertAncestor(info, contentRoot, id);
|
||||
}
|
||||
if (sourceRoot instanceof VirtualFileWithId) {
|
||||
if (sourceRoot instanceof NewVirtualFile) {
|
||||
VirtualFile root = contentRoot == null ? info.getContentRoot() : contentRoot;
|
||||
if (root != null) {
|
||||
assertAncestor(info, root, getId(sourceRoot));
|
||||
assertAncestor(info, root, ((NewVirtualFile)sourceRoot).getId());
|
||||
}
|
||||
}
|
||||
DirectoryInfo newInfo = info.with(module, contentRoot, sourceRoot, libraryClassRoot, (byte)sourceFlag, orderEntries);
|
||||
@@ -694,8 +694,8 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
}
|
||||
|
||||
for (final VirtualFile contentRoot : contentRoots) {
|
||||
if (contentRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithModuleContent(contentRoot, module, contentRoot, progress);
|
||||
if (contentRoot instanceof NewVirtualFile) {
|
||||
fillMapWithModuleContent((NewVirtualFile)contentRoot, module, (NewVirtualFile)contentRoot, progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,18 +718,18 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
}
|
||||
for (SourceFolder sourceFolder : sourceFolders) {
|
||||
VirtualFile dir = sourceFolder.getFile();
|
||||
if (dir instanceof VirtualFileWithId && contentRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithModuleSource(module, contentRoot, dir, sourceFolder.getPackagePrefix(), dir, sourceFolder.isTestSource(), progress);
|
||||
if (dir instanceof NewVirtualFile && contentRoot instanceof NewVirtualFile) {
|
||||
fillMapWithModuleSource(module, (NewVirtualFile)contentRoot, (NewVirtualFile)dir, sourceFolder.getPackagePrefix(), (NewVirtualFile)dir, sourceFolder.isTestSource(), progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillMapWithModuleSource(@NotNull final Module module,
|
||||
@NotNull final VirtualFile contentRoot,
|
||||
@NotNull final VirtualFile dir,
|
||||
@NotNull final NewVirtualFile contentRoot,
|
||||
@NotNull final NewVirtualFile dir,
|
||||
@NotNull final String packageName,
|
||||
@NotNull final VirtualFile sourceRoot,
|
||||
@NotNull final NewVirtualFile sourceRoot,
|
||||
final boolean isTestSource,
|
||||
@Nullable final ProgressIndicator progress) {
|
||||
assert VfsUtilCore.isAncestor(sourceRoot, dir, false) : "SourceRoot: "+sourceRoot+" ("+sourceRoot.getFileSystem()+"); dir: "+dir+" ("+dir.getFileSystem()+")";
|
||||
@@ -741,7 +741,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
if (progress != null) {
|
||||
progress.checkCanceled();
|
||||
}
|
||||
int id = getId(file);
|
||||
int id = ((NewVirtualFile)file).getId();
|
||||
DirectoryInfo info = getInfo(id);
|
||||
if (info == null) return null;
|
||||
if (!module.equals(info.getModule())) return null;
|
||||
@@ -781,17 +781,17 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
if (orderEntry instanceof LibraryOrSdkOrderEntry) {
|
||||
VirtualFile[] sourceRoots = ((LibraryOrSdkOrderEntry)orderEntry).getRootFiles(OrderRootType.SOURCES);
|
||||
for (final VirtualFile sourceRoot : sourceRoots) {
|
||||
if (sourceRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithLibrarySources(sourceRoot, "", sourceRoot, progress);
|
||||
if (sourceRoot instanceof NewVirtualFile) {
|
||||
fillMapWithLibrarySources((NewVirtualFile)sourceRoot, "", (NewVirtualFile)sourceRoot, progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillMapWithLibrarySources(@NotNull final VirtualFile dir,
|
||||
private void fillMapWithLibrarySources(@NotNull final NewVirtualFile dir,
|
||||
@Nullable final String packageName,
|
||||
@NotNull final VirtualFile sourceRoot,
|
||||
@NotNull final NewVirtualFile sourceRoot,
|
||||
@Nullable final ProgressIndicator progress) {
|
||||
VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor<String>() {
|
||||
{ setValueForChildren(packageName); }
|
||||
@@ -799,8 +799,8 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
@Override
|
||||
public boolean visitFile(@NotNull VirtualFile file) {
|
||||
if (progress != null) progress.checkCanceled();
|
||||
int dirId = getId(file);
|
||||
if (!file.isDirectory() && dirId != getId(dir)|| isIgnored(file)) return false;
|
||||
int dirId = ((NewVirtualFile)file).getId();
|
||||
if (!file.isDirectory() && dirId != dir.getId() || isIgnored(file)) return false;
|
||||
DirectoryInfo info = getOrCreateDirInfo(dirId);
|
||||
|
||||
if (info.isInLibrarySource()) { // library sources overlap
|
||||
@@ -829,17 +829,17 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
if (orderEntry instanceof LibraryOrSdkOrderEntry) {
|
||||
VirtualFile[] classRoots = ((LibraryOrSdkOrderEntry)orderEntry).getRootFiles(OrderRootType.CLASSES);
|
||||
for (final VirtualFile classRoot : classRoots) {
|
||||
if (classRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithLibraryClasses(classRoot, "", classRoot, progress);
|
||||
if (classRoot instanceof NewVirtualFile) {
|
||||
fillMapWithLibraryClasses((NewVirtualFile)classRoot, "", (NewVirtualFile)classRoot, progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillMapWithLibraryClasses(@NotNull final VirtualFile dir,
|
||||
private void fillMapWithLibraryClasses(@NotNull final NewVirtualFile dir,
|
||||
@NotNull final String packageName,
|
||||
@NotNull final VirtualFile classRoot,
|
||||
@NotNull final NewVirtualFile classRoot,
|
||||
@Nullable final ProgressIndicator progress) {
|
||||
VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor<String>() {
|
||||
{ setValueForChildren(packageName); }
|
||||
@@ -849,7 +849,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
if (progress != null) progress.checkCanceled();
|
||||
if (!file.isDirectory() && !Comparing.equal(file, dir) || isIgnored(file)) return false;
|
||||
|
||||
int dirId = getId(file);
|
||||
int dirId = ((NewVirtualFile)file).getId();
|
||||
DirectoryInfo info = getOrCreateDirInfo(dirId);
|
||||
|
||||
if (info.hasLibraryClassRoot()) { // library classes overlap
|
||||
@@ -897,8 +897,8 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
|
||||
VirtualFile[] sourceRoots = ((ModuleSourceOrderEntry)orderEntry).getRootModel().getSourceRoots();
|
||||
for (VirtualFile sourceRoot : sourceRoots) {
|
||||
if (sourceRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithOrderEntries(sourceRoot, oneEntryList, entryModule, null, null, null, progress);
|
||||
if (sourceRoot instanceof NewVirtualFile) {
|
||||
fillMapWithOrderEntries((NewVirtualFile)sourceRoot, oneEntryList, entryModule, null, null, null, progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -923,24 +923,24 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
for (Map.Entry<VirtualFile, Collection<OrderEntry>> mapEntry : depEntries.entrySet()) {
|
||||
VirtualFile vRoot = mapEntry.getKey();
|
||||
Collection<OrderEntry> entries = mapEntry.getValue();
|
||||
if (vRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithOrderEntries(vRoot, toSortedArray(entries), null, null, null, null, progress);
|
||||
if (vRoot instanceof NewVirtualFile) {
|
||||
fillMapWithOrderEntries((NewVirtualFile)vRoot, toSortedArray(entries), null, null, null, null, progress);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<VirtualFile, Collection<OrderEntry>> mapEntry : libClassRootEntries.entrySet()) {
|
||||
final VirtualFile vRoot = mapEntry.getKey();
|
||||
final Collection<OrderEntry> entries = mapEntry.getValue();
|
||||
if (vRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithOrderEntries(vRoot, toSortedArray(entries), null, vRoot, null, null, progress);
|
||||
if (vRoot instanceof NewVirtualFile) {
|
||||
fillMapWithOrderEntries((NewVirtualFile)vRoot, toSortedArray(entries), null, (NewVirtualFile)vRoot, null, null, progress);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<VirtualFile, Collection<OrderEntry>> mapEntry : libSourceRootEntries.entrySet()) {
|
||||
final VirtualFile vRoot = mapEntry.getKey();
|
||||
final Collection<OrderEntry> entries = mapEntry.getValue();
|
||||
if (vRoot instanceof VirtualFileWithId) {
|
||||
fillMapWithOrderEntries(vRoot, toSortedArray(entries), null, null, vRoot, null, progress);
|
||||
if (vRoot instanceof NewVirtualFile) {
|
||||
fillMapWithOrderEntries((NewVirtualFile)vRoot, toSortedArray(entries), null, null, (NewVirtualFile)vRoot, null, progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -962,11 +962,11 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
}
|
||||
|
||||
// orderEntries must be sorted BY_OWNER_MODULE
|
||||
protected void fillMapWithOrderEntries(@NotNull VirtualFile root,
|
||||
protected void fillMapWithOrderEntries(@NotNull NewVirtualFile root,
|
||||
@NotNull final OrderEntry[] orderEntries,
|
||||
@Nullable final Module module,
|
||||
@Nullable final VirtualFile libraryClassRoot,
|
||||
@Nullable final VirtualFile librarySourceRoot,
|
||||
@Nullable final NewVirtualFile libraryClassRoot,
|
||||
@Nullable final NewVirtualFile librarySourceRoot,
|
||||
@Nullable final DirectoryInfo parentInfo,
|
||||
@Nullable final ProgressIndicator progress) {
|
||||
VfsUtilCore.visitChildrenRecursively(root, new DirectoryVisitor() {
|
||||
@@ -979,7 +979,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
}
|
||||
if (isIgnored(dir)) return null;
|
||||
|
||||
int dirId = getId(dir);
|
||||
int dirId = ((NewVirtualFile)dir).getId();
|
||||
DirectoryInfo info = getInfo(dirId); // do not create it here!
|
||||
if (info == null) return null;
|
||||
|
||||
@@ -1102,40 +1102,40 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
for (Module module : modules) {
|
||||
for (ContentEntry contentEntry : getContentEntries(module)) {
|
||||
VirtualFile contentRoot = contentEntry.getFile();
|
||||
if (contentRoot == null) continue;
|
||||
if (!(contentRoot instanceof NewVirtualFile)) continue;
|
||||
|
||||
ExcludeFolder[] excludeRoots = contentEntry.getExcludeFolders();
|
||||
for (ExcludeFolder excludeRoot : excludeRoots) {
|
||||
// Output paths should be excluded (if marked as such) regardless if they're under corresponding module's content root
|
||||
VirtualFile excludeRootFile = excludeRoot.getFile();
|
||||
if (excludeRootFile instanceof VirtualFileWithId) {
|
||||
if (excludeRootFile instanceof NewVirtualFile) {
|
||||
if (!FileUtil.startsWith(contentRoot.getUrl(), excludeRoot.getUrl())) {
|
||||
if (isExcludeRootForModule(module, excludeRootFile)) {
|
||||
putForFileAndAllAncestors(excludeRootFile, excludeRoot.getUrl());
|
||||
putForFileAndAllAncestors((NewVirtualFile)excludeRootFile, excludeRoot.getUrl());
|
||||
}
|
||||
myProjectExcludeRoots.add(getId(excludeRootFile));
|
||||
myProjectExcludeRoots.add(((NewVirtualFile)excludeRootFile).getId());
|
||||
}
|
||||
}
|
||||
|
||||
putForFileAndAllAncestors(contentRoot, excludeRoot.getUrl());
|
||||
putForFileAndAllAncestors((NewVirtualFile)contentRoot, excludeRoot.getUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (DirectoryIndexExcludePolicy policy : myExcludePolicies) {
|
||||
for (VirtualFile file : policy.getExcludeRootsForProject()) {
|
||||
if (file instanceof VirtualFileWithId) {
|
||||
putForFileAndAllAncestors(file, file.getUrl());
|
||||
myProjectExcludeRoots.add(getId(file));
|
||||
if (file instanceof NewVirtualFile) {
|
||||
putForFileAndAllAncestors((NewVirtualFile)file, file.getUrl());
|
||||
myProjectExcludeRoots.add(((NewVirtualFile)file).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void putForFileAndAllAncestors(VirtualFile file, String value) {
|
||||
private void putForFileAndAllAncestors(NewVirtualFile file, String value) {
|
||||
TIntObjectHashMap<Set<String>> map = myExcludeRootsMap;
|
||||
while (file != null) {
|
||||
int id = getId(file);
|
||||
int id = file.getId();
|
||||
Set<String> set = map.get(id);
|
||||
if (set == null) {
|
||||
set = new THashSet<String>();
|
||||
@@ -1223,16 +1223,14 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int getId(@NotNull VirtualFile file) {
|
||||
return ((VirtualFileWithId)file).getId();
|
||||
}
|
||||
|
||||
private void assertAncestor(@NotNull DirectoryInfo info, @NotNull VirtualFile root, int myId) {
|
||||
VirtualFile myFile = findFileById(myId);
|
||||
assert myFile.getFileSystem() == root.getFileSystem() : myFile.getFileSystem() +", "+ root.getFileSystem() +"; my file: "+myFile+"; root: "+root + "; "+
|
||||
myFile.getParent().getPath().equals(root.getPath());
|
||||
assert VfsUtilCore.isAncestor(root, myFile, false) : "my file: "+myFile+" ("+getId(myFile)+")" + myFile.getClass() + " - " +System.identityHashCode(myFile) +
|
||||
"; root: "+root +" ("+getId(root)+")" + root.getClass() + " - " +System.identityHashCode(root) +
|
||||
assert VfsUtilCore.isAncestor(root, myFile, false) : "my file: "+myFile+" ("+
|
||||
((NewVirtualFile)myFile).getId() +")" + myFile.getClass() + " - " +System.identityHashCode(myFile) +
|
||||
"; root: "+root +" ("+
|
||||
((NewVirtualFile)root).getId() +")" + root.getClass() + " - " +System.identityHashCode(root) +
|
||||
"; equalsToParent:"+ (myFile.getParent() == null ? "" : myFile.getParent().getPath()).equals(root.getPath()) +
|
||||
"; equalsToRoot:"+ myFile.equals(root) +
|
||||
"; equalsToRootPath:"+ myFile.getPath().equals(root.getPath()) +
|
||||
|
||||
@@ -58,7 +58,7 @@ public final class DirectoryInfo {
|
||||
*/
|
||||
private final OrderEntry[] orderEntries;
|
||||
|
||||
public static DirectoryInfo createNew() {
|
||||
static DirectoryInfo createNew() {
|
||||
return new DirectoryInfo(null, null, null, null, (byte)0, null);
|
||||
}
|
||||
private DirectoryInfo(Module module,
|
||||
@@ -261,7 +261,7 @@ public final class DirectoryInfo {
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<OrderEntry> BY_OWNER_MODULE = new Comparator<OrderEntry>() {
|
||||
static final Comparator<OrderEntry> BY_OWNER_MODULE = new Comparator<OrderEntry>() {
|
||||
@Override
|
||||
public int compare(OrderEntry o1, OrderEntry o2) {
|
||||
String name1 = o1.getOwnerModule().getName();
|
||||
@@ -311,7 +311,7 @@ public final class DirectoryInfo {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DirectoryInfo with(Module module,
|
||||
DirectoryInfo with(Module module,
|
||||
VirtualFile contentRoot,
|
||||
VirtualFile sourceRoot,
|
||||
VirtualFile libraryClassRoot,
|
||||
@@ -323,7 +323,7 @@ public final class DirectoryInfo {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DirectoryInfo withInternedEntries(@NotNull OrderEntry[] orderEntries) {
|
||||
DirectoryInfo withInternedEntries(@NotNull OrderEntry[] orderEntries) {
|
||||
return new DirectoryInfo(module, contentRoot, sourceRoot, libraryClassRoot, sourceFlag, orderEntries);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user