From a6fcbd532604ea417c433b2a03e1f96d08c033f8 Mon Sep 17 00:00:00 2001 From: aboyko Date: Sun, 16 Apr 2023 11:25:02 -0400 Subject: [PATCH] Cleanup evicted name environments --- .../ide/vscode/boot/java/utils/CompilationUnitCache.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/CompilationUnitCache.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/CompilationUnitCache.java index 8165daffb..cca84c58e 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/CompilationUnitCache.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/CompilationUnitCache.java @@ -97,7 +97,13 @@ public final class CompilationUnitCache implements DocumentContentProvider { .build(); this.projectToDocs = CacheBuilder.newBuilder().build(); - this.lookupEnvCache = CacheBuilder.newBuilder().build(); + this.lookupEnvCache = CacheBuilder.newBuilder().removalListener(new RemovalListener, INameEnvironmentWithProgress>>() { + @Override + public void onRemoval(RemovalNotification, INameEnvironmentWithProgress>> notification) { + notification.getValue().getT2().cleanup(); + } + + }).build(); this.documentService = server == null ? null : server.getTextDocumentService();