Skip to content

Commit c22b229

Browse files
authored
Prevent caching outdated AST in CoreASTProvider (eclipse-jdtls#2714)
Attempt to prevent caching outdated AST in CoreASTProvider Signed-off-by: Odin Dahlström <[email protected]>
1 parent 9c2a29d commit c22b229

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDocumentLifeCycleHandler.java

+6
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,13 @@ public ICompilationUnit handleChanged(DidChangeTextDocumentParams params) {
426426

427427
try {
428428
if (unit.equals(sharedASTProvider.getActiveJavaElement())) {
429+
// We call clearReconciliation here in an attempt to prevent getAST calls on other threads
430+
// from caching outdated AST after we just called disposeAST. See also:
431+
// https://github.com/eclipse/eclipse.jdt.ls/issues/1918
432+
// https://github.com/eclipse/eclipse.jdt.ls/pull/2714#discussion_r1234817900
433+
sharedASTProvider.clearReconciliation();
429434
sharedASTProvider.disposeAST();
435+
sharedASTProvider.clearReconciliation();
430436
CodeActionHandler.codeActionStore.clear();
431437
}
432438

0 commit comments

Comments
 (0)