diff --git a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java index 6f5ab184b6be..2e523dbfae46 100644 --- a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java +++ b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java @@ -2146,13 +2146,6 @@ protected void checkFolds(String relFilePath) throws Exception { ParserManager.parse(Collections.singleton(testSource), new UserTask() { public @Override void run(ResultIterator resultIterator) throws Exception { - // FoldingScanner#folds calls source.getDocument(false) and receive non null values on JDK 8. - // On JDK 11+ however the document is null which leads to test failures in FoldingTest#testPHPTags. - // This is likely a race condition which is more likely to occur on JDK 11+ since the test can be - // brute forced to passing on linux if restarted often enough. - // This fixes it by making sure the document is open before folds are computed - assertNotNull(resultIterator.getSnapshot().getSource().getDocument(true)); - StructureScanner analyzer = getStructureScanner(); assertNotNull("getStructureScanner must be implemented", analyzer); diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/csl/FoldingScanner.java b/php/php.editor/src/org/netbeans/modules/php/editor/csl/FoldingScanner.java index f82fa74f4a50..fb565eb64a14 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/csl/FoldingScanner.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/csl/FoldingScanner.java @@ -179,7 +179,7 @@ public Map> folds(ParserResult info) { program.accept(new FoldingVisitor(folds)); Source source = phpParseResult.getSnapshot().getSource(); assert source != null : "source was null"; - Document doc = source.getDocument(false); + Document doc = source.getDocument(true); if (FOLD_PHPTAG) { processPHPTags(folds, doc); }