Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java29
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java2
2 files changed, 30 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
index 897233965f..940fc1687e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
@@ -8778,6 +8778,35 @@ public class ModuleBuilderTests extends ModifyingResourceTests {
deleteProject(prjD);
}
}
+ public void testBug547181Comment104() throws CoreException {
+
+ IJavaProject prjA = createJava9Project("A");
+ IJavaProject prjB = createJava9Project("B");
+ try {
+ // NO module-info.java, so A is accessed as automatic module
+ createFolder("A/src/pack/a");
+
+ createFile("A/src/pack/_some_resource_without_extension",
+ "dummy content\n");
+
+ addModularProjectEntry(prjB, prjA);
+ // ---1---
+ createFolder("B/src/pack/b");
+ createFile("B/src/pack/b/Usage.java",
+ "package pack.b;\n" +
+ "public class Usage {\n" +
+ "}\n");
+ createFile("B/src/module-info.java",
+ "module B {\n" +
+ " requires A;\n" +
+ "}\n");
+ getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ assertNoErrors();
+ } finally {
+ deleteProject(prjA);
+ deleteProject(prjB);
+ }
+ }
protected void assertNoErrors() throws CoreException {
for (IProject p : getWorkspace().getRoot().getProjects()) {
int maxSeverity = p.findMaxProblemSeverity(null, true, IResource.DEPTH_INFINITE);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index c2a0884e19..071252f1e2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -1097,7 +1097,7 @@ public PlainPackageBinding createPlainPackage(char[][] compoundName) {
} else {
packageBinding = getPackage0(compoundName[0]);
if (packageBinding == null || packageBinding == TheNotFoundPackage) {
- packageBinding = this.module.createDeclaredToplevelPackage(compoundName[0]);
+ packageBinding = this.module.getOrCreateDeclaredPackage(new char[][] {compoundName[0]});
if (this.useModuleSystem) {
char[][] declaringModuleNames = null;
if (this.module.isUnnamed()) {

Back to the top