Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2019-03-12 04:04:47 -0400
committerJay Arthanareeswaran2019-03-16 04:53:40 -0400
commite68c447eb7a2a4b0a697b62778de82297fe800c4 (patch)
tree5e2a8af54bd713fe5a01e61aaf98140d81b66439
parentb330307e74ac6c58b263854b69c229782b954bf6 (diff)
downloadeclipse.jdt.core-e68c447eb7a2a4b0a697b62778de82297fe800c4.tar.gz
eclipse.jdt.core-e68c447eb7a2a4b0a697b62778de82297fe800c4.tar.xz
eclipse.jdt.core-e68c447eb7a2a4b0a697b62778de82297fe800c4.zip
Bug 538086 - [9] Java rejects java.* import but ECJ doesn'tY20190316-1220
Change-Id: I4a4def027ac5266a4e015fb866a20b557b6098bf Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java15
2 files changed, 14 insertions, 5 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 81d316fc7b..77d997ea84 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
@@ -4967,10 +4967,10 @@ public class ModuleBuilderTests extends ModifyingResourceTests {
getWorkingCopy("/Test/src/X.java", src, true);
assertProblems("should have not problems",
"----------\n" +
- "1. WARNING in /Test/src/X.java (at line 1)\n" +
+ "1. ERROR in /Test/src/X.java (at line 1)\n" +
" import java.*;\n" +
" ^^^^\n" +
- "The import java is never used\n" +
+ "The package java is not accessible\n" +
"----------\n",
this.problemRequestor);
} finally {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java
index 3b31a807a4..d972ad3db1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java
@@ -73,9 +73,18 @@ public class ModuleBinding extends Binding implements IUpdatableModule {
}
@Override
public boolean canAccess(PackageBinding pkg) {
- ModuleBinding mod = pkg.enclosingModule;
- if (mod != null && mod != this)
- return mod.isPackageExportedTo(pkg, this);
+ if (pkg instanceof SplitPackageBinding) {
+ for (PackageBinding p : ((SplitPackageBinding) pkg).incarnations) {
+ if (canAccess(p)) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ ModuleBinding mod = pkg.enclosingModule;
+ if (mod != null && mod != this)
+ return mod.isPackageExportedTo(pkg, this);
+ }
return true;
}
@Override

Back to the top