Bug 547181 - [9][impl] Reconsider representation and lookup of packages
(SplitPackageBinding)
- restore caching of not-exported packages
Change-Id: Icd692cfc050e956c56882567534a9f83715ea02d
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 35d7962..a8aafd1 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
@@ -753,7 +753,7 @@
}
}
if (packageBinding == null || packageBinding == TheNotFoundPackage) {
- packageBinding = new PlainPackageBinding(constantPoolName[0], this, this.module);
+ packageBinding = this.module.createDeclaredToplevelPackage(constantPoolName[0]);
}
if (isMissing) packageBinding.tagBits |= TagBits.HasMissingType;
this.knownPackages.put(constantPoolName[0], packageBinding); // TODO: split?
@@ -779,7 +779,7 @@
}
}
if (packageBinding == null || packageBinding == TheNotFoundPackage) {
- packageBinding = new PlainPackageBinding(CharOperation.subarray(constantPoolName, 0, i + 1), parent, this, this.module);
+ packageBinding = this.module.createDeclaredPackage(CharOperation.subarray(constantPoolName, 0, i + 1), parent);
}
if (isMissing) {
packageBinding.tagBits |= TagBits.HasMissingType;
@@ -1137,7 +1137,7 @@
packageBinding = singleParent.getPackage0(compoundName[i]);
}
if (packageBinding == null) {
- packageBinding = new PlainPackageBinding(CharOperation.subarray(compoundName, 0, i + 1), parent, this, this.module);
+ packageBinding = this.module.createDeclaredPackage(CharOperation.subarray(compoundName, 0, i + 1), parent);
packageBinding = parent.addPackage(packageBinding, this.module);
}
}
@@ -1651,7 +1651,7 @@
return packageBinding;
}
if (this.nameEnvironment.isPackage(null, name)) {
- this.knownPackages.put(name, packageBinding = new PlainPackageBinding(name, this, this.module));
+ this.knownPackages.put(name, packageBinding = this.module.createDeclaredToplevelPackage(name));
return packageBinding;
}
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 6922d17..e63a5e2 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
@@ -314,6 +314,17 @@
}
// ---
+ PlainPackageBinding createDeclaredToplevelPackage(char[] name) {
+ PlainPackageBinding packageBinding = new PlainPackageBinding(name, this.environment, this);
+ this.declaredPackages.put(name, packageBinding);
+ return packageBinding;
+ }
+
+ PlainPackageBinding createDeclaredPackage(char[][] compoundName, PackageBinding parent) {
+ PlainPackageBinding packageBinding = new PlainPackageBinding(compoundName, parent, this.environment, this);
+ this.declaredPackages.put(CharOperation.concatWith(compoundName, '.'), packageBinding);
+ return packageBinding;
+ }
public PlainPackageBinding getOrCreateDeclaredPackage(char[][] compoundName) {
char[] flatName = CharOperation.concatWith(compoundName, '.');