Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java12
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java7
8 files changed, 27 insertions, 26 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
index 7d70b9a053..5b74b22c5a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -123,7 +123,7 @@ public class QualifiedTypeReference extends TypeReference {
PackageBinding uniquePackage = packageBinding.getVisibleFor(scope.module(), false);
if (uniquePackage instanceof SplitPackageBinding) {
SplitPackageBinding splitPackage = (SplitPackageBinding) uniquePackage;
- scope.problemReporter().conflictingPackagesFromModules(splitPackage, this.sourceStart, (int)this.sourcePositions[typeStart-1]);
+ scope.problemReporter().conflictingPackagesFromModules(splitPackage, scope.module(), this.sourceStart, (int)this.sourcePositions[typeStart-1]);
this.resolvedType = new ProblemReferenceBinding(this.tokens, null, ProblemReasons.Ambiguous);
return null;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java
index 8ac3f0281c..6c4cb11224 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017, 2018 GK Software SE, and others.
+ * Copyright (c) 2017, 2019 GK Software SE, and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -211,7 +211,7 @@ public class BinaryModuleBinding extends ModuleBinding {
if (compoundName.length > 1) {
PackageBinding parent = forcedGetExportedPackage(CharOperation.subarray(compoundName, 0, compoundName.length-1));
binding = new PackageBinding(compoundName, parent, this.environment, this);
- parent.addPackage(binding, this, true);
+ parent.addPackage(binding, this);
return binding;
}
binding = new PackageBinding(compoundName[0], this.environment, this);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
index 0fc226d5fb..0199eae16c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -427,7 +427,7 @@ void faultInImports() {
PackageBinding uniquePackage = ((PackageBinding)importBinding).getVisibleFor(module(), false);
if (uniquePackage instanceof SplitPackageBinding) {
SplitPackageBinding splitPackage = (SplitPackageBinding) uniquePackage;
- problemReporter().conflictingPackagesFromModules(splitPackage, importReference.sourceStart, importReference.sourceEnd);
+ problemReporter().conflictingPackagesFromModules(splitPackage, module(), importReference.sourceStart, importReference.sourceEnd);
continue nextImport;
}
}
@@ -441,7 +441,7 @@ void faultInImports() {
if (importBinding instanceof SplitPackageBinding) {
SplitPackageBinding splitPackage = (SplitPackageBinding) importBinding;
int sourceEnd = (int)(importReference.sourcePositions[splitPackage.compoundName.length-1] & 0xFFFF);
- problemReporter().conflictingPackagesFromModules((SplitPackageBinding) importBinding, importReference.sourceStart, sourceEnd);
+ problemReporter().conflictingPackagesFromModules((SplitPackageBinding) importBinding, module(), importReference.sourceStart, sourceEnd);
continue nextImport;
}
if (!importBinding.isValidBinding()) {
@@ -472,7 +472,7 @@ void faultInImports() {
if (importedPackage instanceof SplitPackageBinding) {
SplitPackageBinding splitPackage = (SplitPackageBinding) importedPackage;
int sourceEnd = (int) importReference.sourcePositions[splitPackage.compoundName.length-1];
- problemReporter().conflictingPackagesFromModules(splitPackage, importReference.sourceStart, sourceEnd);
+ problemReporter().conflictingPackagesFromModules(splitPackage, module(), importReference.sourceStart, sourceEnd);
continue nextImport;
}
}
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 27a8af6ed1..14abe12ca0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -772,7 +772,7 @@ private PackageBinding computePackageFrom(char[][] constantPoolName, boolean isM
if (isMissing) {
packageBinding.tagBits |= TagBits.HasMissingType;
}
- packageBinding = parent.addPackage(packageBinding, this.module, true);
+ packageBinding = parent.addPackage(packageBinding, this.module);
}
}
if (packageBinding instanceof SplitPackageBinding) {
@@ -1122,7 +1122,7 @@ public PackageBinding createPackage(char[][] compoundName) {
}
if (packageBinding == null) {
packageBinding = new PackageBinding(CharOperation.subarray(compoundName, 0, i + 1), parent, this, this.module);
- packageBinding = parent.addPackage(packageBinding, this.module, true);
+ packageBinding = parent.addPackage(packageBinding, this.module);
}
}
}
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 c799b88d0a..66e02b7a3c 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
@@ -571,7 +571,7 @@ public class ModuleBinding extends Binding implements IUpdatableModule {
if (declaredPackage != null) {
// don't add foreign package to 'parent' (below), but to its own parent:
if (declaredPackage.parent != null)
- declaredPackage.parent.addPackage(declaredPackage, declaringModule, true);
+ declaredPackage.parent.addPackage(declaredPackage, declaringModule);
parent = null;
//
binding = SplitPackageBinding.combine(declaredPackage, binding, this);
@@ -591,15 +591,19 @@ public class ModuleBinding extends Binding implements IUpdatableModule {
binding = combineWithPackagesFromOtherRelevantModules(binding, subPkgCompoundName, declaringModuleNames);
}
if (binding == null || !binding.isValidBinding()) {
- if (parent != null && !packageMayBeIncomplete) // don't remember package that may still lack some siblings
+ if (parent != null
+ && !packageMayBeIncomplete // don't remember package that may still lack some siblings
+ && !(parent instanceof SplitPackageBinding)) // don't store problem into SPB, because from different focus things may look differently
+ {
parent.knownPackages.put(name, binding == null ? LookupEnvironment.TheNotFoundPackage : binding);
+ }
return null;
}
// remember
if (parentName.length == 0)
binding.environment.knownPackages.put(name, binding);
else if (parent != null)
- binding = parent.addPackage(binding, this, false);
+ binding = parent.addPackage(binding, this);
return addPackage(binding, false);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
index d7d4555f0c..4054281c71 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
@@ -86,10 +86,10 @@ private void addNotFoundType(char[] simpleName) {
}
/**
* Remembers a sub-package.
- * For a split parent package this will include enriching with siblings, if checkForSplitSiblings is true
+ * For a split parent package this will include potentially enriching with siblings,
* in which case the enriched (split) binding will be returned.
*/
-PackageBinding addPackage(PackageBinding element, ModuleBinding module, boolean checkForSplitSiblings) {
+PackageBinding addPackage(PackageBinding element, ModuleBinding module) {
if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit();
this.knownPackages.put(element.compoundName[element.compoundName.length - 1], element);
return element;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java
index 47221fe09c..8bb5266322 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java
@@ -83,22 +83,18 @@ public class SplitPackageBinding extends PackageBinding {
}
}
}
- PackageBinding addPackage(PackageBinding element, ModuleBinding module) {
- return addPackage(element, module, true);
- }
@Override
- PackageBinding addPackage(PackageBinding element, ModuleBinding module, boolean enrichWithSplitSiblings) {
+ PackageBinding addPackage(PackageBinding element, ModuleBinding module) {
char[] simpleName = element.compoundName[element.compoundName.length-1];
// enrich
- if (enrichWithSplitSiblings)
- element = combineWithSiblings(element, simpleName, module);
+ element = combineWithSiblings(element, simpleName, module);
PackageBinding visible = this.knownPackages.get(simpleName);
visible = SplitPackageBinding.combine(element, visible, this.enclosingModule);
this.knownPackages.put(simpleName, visible);
PackageBinding incarnation = getIncarnation(element.enclosingModule);
if (incarnation != null)
- incarnation.addPackage(element, module, enrichWithSplitSiblings);
+ incarnation.addPackage(element, module);
return element;
}
@@ -112,6 +108,8 @@ public class SplitPackageBinding extends PackageBinding {
ModuleBinding moduleBinding = incarnation.enclosingModule;
if (moduleBinding == module)
continue;
+ if (childPackage.isDeclaredIn(moduleBinding))
+ continue;
PackageBinding next = moduleBinding.getVisiblePackage(incarnation, name, false);
childPackage = combine(next, childPackage, primaryModule);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 5628deab94..a4db767ee5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -3344,10 +3344,9 @@ public void importProblem(ImportReference importRef, Binding expectedImport) {
}
invalidType(importRef, (TypeBinding)expectedImport);
}
-public void conflictingPackagesFromModules(SplitPackageBinding splitPackage, int sourceStart, int sourceEnd) {
- ModuleBinding enclosingModule = splitPackage.enclosingModule;
+public void conflictingPackagesFromModules(SplitPackageBinding splitPackage, ModuleBinding focusModule, int sourceStart, int sourceEnd) {
String modules = splitPackage.incarnations.stream()
- .filter(enclosingModule::canAccess)
+ .filter(focusModule::canAccess)
.map(p -> String.valueOf(p.enclosingModule.readableName()))
.sorted()
.collect(Collectors.joining(", ")); //$NON-NLS-1$

Back to the top