From 3d1ac364f4f922b39d158f677e315bb66a9ecb4c Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Thu, 5 Apr 2018 15:01:22 +0200 Subject: [PATCH] AstLoadingFilter: allow enabling loading for a file before disabling it --- .../src/com/intellij/util/AstLoadingFilter.java | 3 --- .../com/intellij/util/AstLoadingFilterTest.java | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/platform/core-api/src/com/intellij/util/AstLoadingFilter.java b/platform/core-api/src/com/intellij/util/AstLoadingFilter.java index 4ceac3d49a25..ac7265fbc480 100644 --- a/platform/core-api/src/com/intellij/util/AstLoadingFilter.java +++ b/platform/core-api/src/com/intellij/util/AstLoadingFilter.java @@ -144,9 +144,6 @@ public class AstLoadingFilter { public static T forceEnableTreeLoading(@NotNull VirtualFile virtualFile, @NotNull ThrowableComputable computable) throws E { - if (myDisabledInfo.get() == null) { - throw new IllegalStateException("It's not allowed to force enable loading before it has been disabled"); - } Set enabledFiles = myForcedEnabledFiles.get(); if (enabledFiles.add(virtualFile)) { try { diff --git a/platform/platform-tests/testSrc/com/intellij/util/AstLoadingFilterTest.java b/platform/platform-tests/testSrc/com/intellij/util/AstLoadingFilterTest.java index e786e165c066..8871962006ec 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/AstLoadingFilterTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/AstLoadingFilterTest.java @@ -89,20 +89,4 @@ public class AstLoadingFilterTest extends LightPlatformCodeInsightFixtureTestCas ) )); } - - public void testForceEnableLoadingBeforeDisabling() throws Throwable { - PsiFileImpl file = addFile(); - assertFalse(file.isContentsLoaded()); - assertException(new AbstractExceptionCase() { - @Override - public Class getExpectedExceptionClass() { - return IllegalStateException.class; - } - - @Override - public void tryClosure() throws IllegalStateException { - forceEnableTreeLoading(file, () -> file.getNode()); - } - }); - } }