Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2020-03-05 18:31:01 +0000
committerStephan Herrmann2020-03-10 12:39:38 +0000
commitf029daf7acccc5f5889eb324b1ca254310bcea0a (patch)
tree2bee7bf006b79bbd8f811d1171f370a4168620f2
parente58a73a30002eec95ace959394ec18f1f85b30ef (diff)
downloadeclipse.jdt.core-f029daf7acccc5f5889eb324b1ca254310bcea0a.tar.gz
eclipse.jdt.core-f029daf7acccc5f5889eb324b1ca254310bcea0a.tar.xz
eclipse.jdt.core-f029daf7acccc5f5889eb324b1ca254310bcea0a.zip
not work in modular context Change-Id: I9d9a5df97a84555635dbadb48514da95da6432ce
-rw-r--r--org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.core.tests.model/pom.xml2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests9.java24
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java17
4 files changed, 38 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
index 851e327040..d89498d9a1 100644
--- a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.model;singleton:=true
-Bundle-Version: 3.10.1100.qualifier
+Bundle-Version: 3.10.1200.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests,
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index c4ba6a5859..c2cd4c94b2 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.tests.model</artifactId>
- <version>3.10.1100-SNAPSHOT</version>
+ <version>3.10.1200-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests9.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests9.java
index 3dbfe28d00..bd0dbec7b1 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests9.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests9.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016, 2019 IBM Corporation and others.
+ * Copyright (c) 2016, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1624,4 +1624,26 @@ public void testBug548888() throws Exception {
deleteProject(project1);
}
}
+public void testBug560606() throws CoreException {
+ IJavaProject project1 = createJavaProject("Completion9_1", new String[] {"src"}, new String[] {"JCL19_LIB", "org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, "bin", "9");
+ try {
+ project1.open(null);
+ createFile("/Completion9_1/src/module-info.java",
+ "module first {}\n");
+
+ CompletionResult result = complete(
+ "/Completion9_1/src/bug560606/Test.java",
+ "package bug560606;\n" +
+ "import java.util.Coll;\n" +
+ "public class Test {\n" +
+ "}\n",
+ "import java.util.Coll");
+
+ assertResults(
+ "Collection[TYPE_REF]{Collection, java.util, Ljava.util.Collection;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}",
+ result.proposals);
+ } finally {
+ deleteProject(project1);
+ }
+}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index f1fbccd677..be8a27c6a5 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -1667,13 +1667,22 @@ public final class CompletionEngine
}
private char[] appendUnlessNextToken(char[] completionName, char[] suffix, int nextToken) {
- this.parser.scanner.resetTo(this.endPosition, Integer.MAX_VALUE);
+ if (this.source == null)
+ return CharOperation.concat(completionName, suffix);
+
+ AssistParser assistParser = getParser();
+ Object parserState = assistParser.becomeSimpleParser();
+
+ assistParser.scanner.setSource(this.source);
+ assistParser.scanner.resetTo(this.endPosition, Integer.MAX_VALUE);
try {
- if (this.parser.scanner.getNextToken() != nextToken) {
+ if (assistParser.scanner.getNextToken() != nextToken) {
return CharOperation.concat(completionName, suffix);
}
} catch (InvalidInputException e) {
// ignore
+ } finally {
+ assistParser.restoreAssistParser(parserState);
}
return completionName;
}
@@ -2059,7 +2068,8 @@ public final class CompletionEngine
this.actualCompletionPosition = completionPosition - 1;
this.offset = pos;
this.typeRoot = root;
-
+ this.source = sourceUnit.getContents();
+
this.checkCancel();
// for now until we can change the UI.
@@ -2259,7 +2269,6 @@ public final class CompletionEngine
this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
if ((this.unitScope = parsedUnit.scope) != null) {
- this.source = sourceUnit.getContents();
this.lookupEnvironment.completeTypeBindings(parsedUnit, true);
parsedUnit.scope.faultInTypes();
parseBlockStatements(parsedUnit, this.actualCompletionPosition);

Back to the top