Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-06-07 14:58:30 +0000
committerStephan Herrmann2019-07-02 14:25:31 +0000
commit1fbf13c28311e9090a4ae402b14adbc440f874ec (patch)
tree9a25525de352e1b137729d7186177b0a19878a8b /org.eclipse.jdt.compiler.apt/src
parent5d58390bf2fb018a53c69e075d1416a113301107 (diff)
downloadeclipse.jdt.core-1fbf13c28311e9090a4ae402b14adbc440f874ec.tar.gz
eclipse.jdt.core-1fbf13c28311e9090a4ae402b14adbc440f874ec.tar.xz
eclipse.jdt.core-1fbf13c28311e9090a4ae402b14adbc440f874ec.zip
Bug 547181 - [9][impl] Reconsider representation and lookup of packages
(SplitPackageBinding) - early creation of plain PB into MB.declaredPackages: - from CUS.buildTypeBindins() -> PVS.resolvePackageReference() - includes early application of add-exports - later add all (plain) packages with CUs associated to this module - avoid passing elements of MD.declaredPackages to clients - let MD.analyseReferencedPackages be responsible for error reporting - unify severity determination after bug 521497 - sketch of package scanning for auto modules (may be incomplete) - add a search for inaccessible package/type for better error reporting - when limit-modules present distinguish inaccessible vs. unobservable - improve package scan in ClasspathMultiDirectory - refactoring to avoid some "instanceof SplitPackageBinding" - apply add-reads early, too - throw ISE if reentrance still happens in package lookup (TESTING) - throw ISE if add-reads is applied when packages already exist - remove MB.isPackageLookupActive and related code Refactoring: introduce PlainPackageBinding for more precise typechecking Change-Id: I5f96bc7a487adfff75737a66096598e1c638c4d9
Diffstat (limited to 'org.eclipse.jdt.compiler.apt/src')
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java5
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java14
2 files changed, 6 insertions, 13 deletions
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
index c865529a65..8ea41f0242 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
@@ -52,7 +52,6 @@ import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
-import org.eclipse.jdt.internal.compiler.lookup.SplitPackageBinding;
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
@@ -392,8 +391,8 @@ public class Factory {
*/
public PackageElement newPackageElement(PackageBinding binding)
{
- if (binding instanceof SplitPackageBinding && binding.enclosingModule != null) {
- binding = ((SplitPackageBinding) binding).getIncarnation(binding.enclosingModule);
+ if (binding != null && binding.enclosingModule != null) {
+ binding = binding.getIncarnation(binding.enclosingModule);
}
if (binding == null) {
return null;
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java
index 86183925d5..62e8caedee 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java
@@ -55,10 +55,7 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement {
}
private PackageBinding getModulesPackageBinding(PackageBinding binding) {
- if (binding instanceof SplitPackageBinding) {
- return ((SplitPackageBinding) binding).getIncarnation(this.binding);
- }
- return binding;
+ return binding.getIncarnation(this.binding);
}
@Override
@@ -85,9 +82,8 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement {
@Override
public List<? extends Element> getEnclosedElements() {
ModuleBinding module = this.binding;
- PackageBinding[] packs = module.declaredPackages.valueTable;
Set<PackageBinding> unique = new HashSet<>();
- for (PackageBinding p : packs) {
+ for (PackageBinding p : module.declaredPackages.values()) {
if (p == null)
continue;
if (p instanceof SplitPackageBinding) {
@@ -111,12 +107,10 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement {
unique.add(def);
}
} else {
- packs = this.binding.getExports();
- for (PackageBinding pBinding : packs) {
+ for (PackageBinding pBinding : this.binding.getExports()) {
unique.add(getModulesPackageBinding(pBinding));
}
- packs = this.binding.getOpens();
- for (PackageBinding pBinding : packs) {
+ for (PackageBinding pBinding : this.binding.getOpens()) {
unique.add(getModulesPackageBinding(pBinding));
}
}

Back to the top