mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make sure that CompilerTester is disposed
This commit is contained in:
@@ -489,15 +489,18 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
public static void checkEditorsReleased() {
|
||||
// don't use method references here to make stack trace reading easier
|
||||
//noinspection Convert2MethodRef
|
||||
RunAll runAll = new RunAll(() -> UIUtil.dispatchAllInvocationEvents());
|
||||
for (Editor editor : EditorFactory.getInstance().getAllEditors()) {
|
||||
runAll = runAll
|
||||
.append(
|
||||
() -> EditorFactoryImpl.throwNotReleasedError(editor),
|
||||
() -> EditorFactory.getInstance().releaseEditor(editor)
|
||||
);
|
||||
}
|
||||
runAll.run();
|
||||
new RunAll(
|
||||
() -> UIUtil.dispatchAllInvocationEvents(),
|
||||
() -> {
|
||||
// getAllEditors() should be called only after dispatchAllInvocationEvents(), that's why separate RunAll is used
|
||||
RunAll runAll = new RunAll();
|
||||
for (Editor editor : EditorFactory.getInstance().getAllEditors()) {
|
||||
runAll = runAll
|
||||
.append(() -> EditorFactoryImpl.throwNotReleasedError(editor))
|
||||
.append(() -> EditorFactory.getInstance().releaseEditor(editor));
|
||||
}
|
||||
runAll.run();
|
||||
}).run();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.intellij.util.lang.CompoundRuntimeException;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,7 @@ public class RunAll implements Runnable {
|
||||
@SafeVarargs
|
||||
@Contract(pure=true)
|
||||
public final RunAll append(@NotNull ThrowableRunnable<Throwable>... actions) {
|
||||
return new RunAll(ContainerUtil.concat(myActions, ContainerUtilRt.newArrayList(actions)));
|
||||
return new RunAll(ContainerUtil.concat(myActions, actions.length == 1 ? Collections.singletonList(actions[0]) : ContainerUtilRt.newArrayList(actions)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user