Fix issue with nested project classpath finder
Choose the most nested project in case of ambiguity.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<factorypath>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/language-server-starter/1.1.0-SNAPSHOT/language-server-starter-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter/2.0.5.RELEASE/spring-boot-starter-2.0.5.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/2.0.5.RELEASE/spring-boot-autoconfigure-2.0.5.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-logging/2.0.5.RELEASE/spring-boot-starter-logging-2.0.5.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
@@ -8,9 +9,9 @@
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/5.0.9.RELEASE/spring-core-5.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-jcl/5.0.9.RELEASE/spring-jcl-5.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/eclipse/org.json/1.0/org.json-1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/java-properties/1.1.0-SNAPSHOT/java-properties-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/commons-util/1.1.0-SNAPSHOT/commons-util-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/javolution/javolution-core-java/6.0.0/javolution-core-java-6.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/cglib/cglib/3.2.7/cglib-3.2.7.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/ant/ant/1.10.3/ant-1.10.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
@@ -19,6 +20,7 @@
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jsoup/jsoup/1.9.2/jsoup-1.9.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/19.0/guava-19.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/commons-maven/1.1.0-SNAPSHOT/commons-maven-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/maven/maven-core/3.3.9/maven-core-3.3.9.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/maven/maven-model/3.3.9/maven-model-3.3.9.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/maven/maven-settings/3.3.9/maven-settings-3.3.9.jar" enabled="true" runInBatchMode="false"/>
|
||||
@@ -59,8 +61,11 @@
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/maven/wagon/wagon-file/2.10/wagon-file-2.10.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/maven/wagon/wagon-provider-api/2.10/wagon-provider-api-2.10.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/commons-java/1.1.0-SNAPSHOT/commons-java-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/jandex/2.0.5.Final/jandex-2.0.5.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/commons-gradle/1.1.0-SNAPSHOT/commons-gradle-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/gradle/gradle-tooling-api/4.3/gradle-tooling-api-4.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/commons-language-server/1.1.0-SNAPSHOT/commons-language-server-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot/2.0.5.RELEASE/spring-boot-2.0.5.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context/5.0.9.RELEASE/spring-context-5.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-aop/5.0.9.RELEASE/spring-aop-5.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
@@ -68,10 +73,13 @@
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-expression/5.0.9.RELEASE/spring-expression-5.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/projectreactor/reactor-core/3.1.9.RELEASE/reactor-core-3.1.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/reactivestreams/reactive-streams/1.0.2/reactive-streams-1.0.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/commons-yaml/1.1.0-SNAPSHOT/commons-yaml-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/yaml/snakeyaml/1.19/snakeyaml-1.19.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/ide/vscode/commons-boot-app-cli/1.1.0-SNAPSHOT/commons-boot-app-cli-1.1.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/json/json/20160810/json-20160810.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-codec/commons-codec/1.11/commons-codec-1.11.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="EXTJAR" id="/usr/lib/jvm/java-8-oracle/jre/../lib/tools.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm/6.1.1/asm-6.1.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/jdt/org.eclipse.jdt.core/3.15.0/org.eclipse.jdt.core-3.15.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/platform/org.eclipse.core.resources/3.13.100/org.eclipse.core.resources-3.13.100.jar" enabled="true" runInBatchMode="false"/>
|
||||
@@ -88,6 +96,8 @@
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/platform/org.eclipse.text/3.7.0/org.eclipse.text-3.7.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/platform/org.eclipse.core.commands/3.9.200/org.eclipse.core.commands-3.9.200.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-io/commons-io/2.4/commons-io-2.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/5.0.9.RELEASE/spring-core-5.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-jcl/5.0.9.RELEASE/spring-jcl-5.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/lsp4j/org.eclipse.lsp4j/0.4.0-SNAPSHOT/org.eclipse.lsp4j-0.4.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/lsp4j/org.eclipse.lsp4j.generator/0.4.0-SNAPSHOT/org.eclipse.lsp4j.generator-0.4.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/xtend/org.eclipse.xtend.lib/2.16.0-SNAPSHOT/org.eclipse.xtend.lib-2.16.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.ide.vscode.commons.util.UriUtil;
|
||||
import reactor.core.Disposable;
|
||||
|
||||
public class JdtLsProjectCache implements InitializableJavaProjectsService {
|
||||
|
||||
|
||||
private SimpleLanguageServer server;
|
||||
private Map<String, JavaProject> table = new HashMap<String, JavaProject>();
|
||||
private Logger log = LoggerFactory.getLogger(JdtLsProjectCache.class);
|
||||
@@ -94,7 +94,7 @@ public class JdtLsProjectCache implements InitializableJavaProjectsService {
|
||||
}
|
||||
deleted.dispose();
|
||||
}
|
||||
|
||||
|
||||
private void notifyChanged(JavaProject newProject) {
|
||||
logEvent("Changed", newProject);
|
||||
synchronized (listeners) {
|
||||
@@ -112,7 +112,7 @@ public class JdtLsProjectCache implements InitializableJavaProjectsService {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static int countSourceAttachments(Collection<CPE> classpathEntries) {
|
||||
int count = 0;
|
||||
for (CPE cpe : classpathEntries) {
|
||||
@@ -134,18 +134,29 @@ public class JdtLsProjectCache implements InitializableJavaProjectsService {
|
||||
String uri = UriUtil.normalize(doc.getUri());
|
||||
log.debug("find {} ", uri);
|
||||
synchronized (table) {
|
||||
String foundUri = null;
|
||||
IJavaProject foundProject = null;
|
||||
for (Entry<String, JavaProject> e : table.entrySet()) {
|
||||
String projectUri = e.getKey();
|
||||
log.debug("projectUri = '{}'", projectUri);
|
||||
if (UriUtil.contains(projectUri, uri)) {
|
||||
log.debug("found {} for {}", e.getValue(), uri);
|
||||
return Optional.of(e.getValue());
|
||||
if (foundUri==null) {
|
||||
log.debug("found {} for {}", e.getValue(), uri);
|
||||
foundUri = projectUri;
|
||||
foundProject = e.getValue();
|
||||
} else if (UriUtil.contains(foundUri, projectUri)) {
|
||||
log.debug("found more nested {} for {}", e.getValue(), uri);
|
||||
foundUri = projectUri;
|
||||
foundProject = e.getValue();
|
||||
} else {
|
||||
log.debug("found {} for {} but keeping {}", e.getValue(), uri, foundProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Optional.ofNullable(foundProject);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IJavadocProvider javadocProvider(String projectUri, CPE classpathEntry) {
|
||||
return new JdtLsJavadocProvider(server.getClient(), projectUri);
|
||||
|
||||
@@ -5,5 +5,5 @@ spring:
|
||||
bindings:
|
||||
input:
|
||||
consumer:
|
||||
auto-bing-dlq: true
|
||||
auto-bind-dlq: true
|
||||
|
||||
Reference in New Issue
Block a user