Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-07-05 21:02:24 +0000
committerStephan Herrmann2019-07-05 21:02:24 +0000
commitb62b223587dcd5da652588c255ae8a2001bb7091 (patch)
tree34233d51a9c9ae6c789676707790b46f0c24577b
parent357185ef691b346646bc98aa38ba4950222dbc6a (diff)
downloadeclipse.jdt.core-I20190705-1800.tar.gz
eclipse.jdt.core-I20190705-1800.tar.xz
eclipse.jdt.core-I20190705-1800.zip
Bug 547181 - [9][impl] Reconsider representation and lookup of packagesI20190705-1800
(SplitPackageBinding) - restore caching of not-exported packages Change-Id: Icd692cfc050e956c56882567534a9f83715ea02d
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java11
2 files changed, 15 insertions, 4 deletions
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 35d796223c..a8aafd1897 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 @@ private PackageBinding computePackageFrom(char[][] constantPoolName, boolean isM
}
}
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 @@ private PackageBinding computePackageFrom(char[][] constantPoolName, boolean isM
}
}
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 @@ public PlainPackageBinding createPlainPackage(char[][] compoundName) {
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 @@ PackageBinding getTopLevelPackage(char[] name) {
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 6922d17913..e63a5e22ef 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 @@ public class ModuleBinding extends Binding implements IUpdatableModule {
}
// ---
+ 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, '.');

Back to the top