mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diagnostics for EditorHistoryManagerTest.testSavingStateForNotOpenedEditors
This commit is contained in:
+14
-1
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.fileEditor.impl;
|
||||
|
||||
import com.intellij.diagnostic.ThreadDumper;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.components.impl.ComponentManagerImpl;
|
||||
@@ -22,6 +23,7 @@ import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
@@ -45,11 +47,22 @@ public class EditorHistoryManagerTest extends PlatformTestCase {
|
||||
FileEditorManager.getInstance(project).closeFile(virtualFile);
|
||||
});
|
||||
|
||||
String threadDumpBefore = ThreadDumper.dumpThreadsToString();
|
||||
|
||||
GCUtil.tryGcSoftlyReachableObjects();
|
||||
|
||||
WeakReference<Object> weakReference = new WeakReference<>(new Object());
|
||||
do {
|
||||
//noinspection CallToSystemGC
|
||||
System.gc();
|
||||
}
|
||||
while (weakReference.get() != null);
|
||||
|
||||
Document document = FileDocumentManager.getInstance().getCachedDocument(virtualFile);
|
||||
if (document != null) {
|
||||
fail("Document wasn't collected, see heap dump at " + publishHeapDump(EditorHistoryManagerTest.class.getName()));
|
||||
System.out.println("Keeping a reference to the document: " + document);
|
||||
System.err.println("Keeping a reference to the document: " + document);
|
||||
System.err.println(threadDumpBefore);
|
||||
}
|
||||
|
||||
openProjectPerformTaskCloseProject(dir, project -> {});
|
||||
|
||||
Reference in New Issue
Block a user