mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix after "fix visibility" global refactoring (VirtualFilePointerManager)
GitOrigin-RevId: bce0d808ccafe328ffaa1caf2db8fbe6333c92d9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b4a3c892df
commit
8e4a29ca18
@@ -49,8 +49,8 @@ public class FilePartNode {
|
||||
volatile @NotNull Object fileOrUrl;
|
||||
|
||||
/** The file system of this particular component. E.g. for path "/x.jar!/foo.txt" the node "x.jar" fs is LocalFileSystem, the node "foo.txt" fs is JarFileSystem */
|
||||
@VisibleForTesting
|
||||
public final NewVirtualFileSystem fs;
|
||||
@NotNull
|
||||
final NewVirtualFileSystem fs;
|
||||
|
||||
FilePartNode(int nameId,
|
||||
@NotNull Object fileOrUrl,
|
||||
@@ -494,7 +494,7 @@ public class FilePartNode {
|
||||
}
|
||||
|
||||
void addAllPointersTo(@NotNull Collection<? super VirtualFilePointerImpl> outList) {
|
||||
processPointers(p->{ if (p.getNode() != null) outList.add(p); });
|
||||
processPointers(p->{ if (p.myNode != null) outList.add(p); });
|
||||
}
|
||||
|
||||
void processPointers(@NotNull Consumer<? super VirtualFilePointerImpl> processor) {
|
||||
|
||||
@@ -326,7 +326,7 @@ public final class FilePartNodeRoot extends FilePartNode {
|
||||
}
|
||||
|
||||
void removePointer(@NotNull VirtualFilePointerImpl pointer) {
|
||||
FilePartNode node = pointer.getNode();
|
||||
FilePartNode node = pointer.myNode;
|
||||
int remainingLeaves = node.removeLeaf(pointer);
|
||||
if (remainingLeaves == 0) {
|
||||
VirtualFile file = fileOrNull(node.fileOrUrl);
|
||||
|
||||
+11
-1
@@ -7,6 +7,7 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.util.TraceableDisposable;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem;
|
||||
import com.intellij.openapi.vfs.newvfs.NewVirtualFileSystem;
|
||||
import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
|
||||
import com.intellij.openapi.vfs.pointers.VirtualFilePointerListener;
|
||||
import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
|
||||
@@ -30,7 +31,9 @@ public class VirtualFilePointerImpl extends TraceableDisposable implements Virtu
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public FilePartNode getNode() {
|
||||
@TestOnly
|
||||
public FilePartNode getNodeForTesting() {
|
||||
assert ApplicationManager.getApplication().isUnitTestMode();
|
||||
return myNode;
|
||||
}
|
||||
|
||||
@@ -50,6 +53,13 @@ public class VirtualFilePointerImpl extends TraceableDisposable implements Virtu
|
||||
return index >= 0 ? url.substring(index + 1) : url;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@TestOnly
|
||||
public NewVirtualFileSystem getFileSystemForTesting() {
|
||||
assert ApplicationManager.getApplication().isUnitTestMode();
|
||||
return myNode.fs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile getFile() {
|
||||
FilePartNode node = checkDisposed(myNode);
|
||||
|
||||
+2
-2
@@ -758,7 +758,7 @@ public final class VirtualFilePointerManagerImpl extends VirtualFilePointerManag
|
||||
if (!shouldKill) {
|
||||
return false;
|
||||
}
|
||||
getRoot(pointer.getNode().fs).removePointer(pointer);
|
||||
getRoot(pointer.myNode.fs).removePointer(pointer);
|
||||
pointer.myNode = null;
|
||||
assertConsistency();
|
||||
myPointerSetModCount++;
|
||||
@@ -811,7 +811,7 @@ public final class VirtualFilePointerManagerImpl extends VirtualFilePointerManag
|
||||
Reference2IntMap.Entry<VirtualFilePointerImpl> entry = iterator.next();
|
||||
VirtualFilePointerImpl pointer = entry.getKey();
|
||||
int disposeCount = entry.getIntValue();
|
||||
boolean isDisposed = !(pointer instanceof IdentityVirtualFilePointer) && pointer.getNode() == null;
|
||||
boolean isDisposed = !(pointer instanceof IdentityVirtualFilePointer) && pointer.myNode == null;
|
||||
if (isDisposed) {
|
||||
pointer.throwDisposalError("Already disposed:\n" + pointer.getStackTrace());
|
||||
}
|
||||
|
||||
+4
-4
@@ -249,7 +249,7 @@ public class VirtualFilePointerTest extends BareTestFixtureTestCase {
|
||||
connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {
|
||||
@Override
|
||||
public void after(@NotNull List<? extends @NotNull VFileEvent> events) {
|
||||
Object url = ((VirtualFilePointerImpl)pointer).getNode().getFileOrUrl();
|
||||
Object url = ((VirtualFilePointerImpl)pointer).getNodeForTesting().getFileOrUrl();
|
||||
assertTrue(url.toString(), url instanceof String);
|
||||
assertFalse(pointer.isValid());
|
||||
}
|
||||
@@ -802,7 +802,7 @@ public class VirtualFilePointerTest extends BareTestFixtureTestCase {
|
||||
try {
|
||||
ready.countDown();
|
||||
while (run.get()) {
|
||||
bb.getNode().update(((VirtualFilePointerImpl)fileToCreatePointer).getNode(), fakeRoot, "test", null);
|
||||
bb.getNodeForTesting().update(((VirtualFilePointerImpl)fileToCreatePointer).getNodeForTesting(), fakeRoot, "test", null);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
@@ -1360,7 +1360,7 @@ public class VirtualFilePointerTest extends BareTestFixtureTestCase {
|
||||
assertEquals(expectedPointerRelativeUrl, StringUtil.trimStart(pointer.getUrl(), "jar://" + tempRoot + "/" + abc));
|
||||
String expectedPointerFileNameToCheck = expectedPointerFileName == null ? abc : expectedPointerFileName;
|
||||
assertEquals(expectedPointerFileNameToCheck, pointer.getFileName());
|
||||
assertEquals(JarFileSystem.getInstance(), ((VirtualFilePointerImpl)pointer).getNode().fs);
|
||||
assertEquals(JarFileSystem.getInstance(), ((VirtualFilePointerImpl)pointer).getFileSystemForTesting());
|
||||
assertFalse(pointer.isValid());
|
||||
|
||||
File jar = IoTestUtil.createTestJar(new File(tempRoot+"/"+abc), List.of(Pair.create(expectedPathInsideJar, new byte[]{' ', ' '})));
|
||||
@@ -1376,7 +1376,7 @@ public class VirtualFilePointerTest extends BareTestFixtureTestCase {
|
||||
VirtualFilePointer pointer = VirtualFilePointerManager.getInstance().create(sourceUrl, disposable, null);
|
||||
assertEquals(expectedPointerUrl, pointer.getUrl());
|
||||
assertEquals(expectedPointerFileName, pointer.getFileName());
|
||||
assertEquals(JarFileSystem.getInstance(), ((VirtualFilePointerImpl)pointer).getNode().fs);
|
||||
assertEquals(JarFileSystem.getInstance(), ((VirtualFilePointerImpl)pointer).getFileSystemForTesting());
|
||||
assertFalse(pointer.isValid());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user