Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2019-07-09 14:43:22 -0400
committerTill Brychcy2019-07-09 14:43:22 -0400
commit32a3857797bf19248aee13ba9b4a02f63d66f233 (patch)
tree0a88047bb0f532380314019d2a8c8058f9ab3f4b
parente4fe6ea66ca018ddb36a728587b87392d8f5c0b8 (diff)
downloadeclipse.jdt.core-32a3857797bf19248aee13ba9b4a02f63d66f233.tar.gz
eclipse.jdt.core-32a3857797bf19248aee13ba9b4a02f63d66f233.tar.xz
eclipse.jdt.core-32a3857797bf19248aee13ba9b4a02f63d66f233.zip
Bug 547181 - [9][impl] Reconsider representation and lookup of packagesI20190709-1800
(SplitPackageBinding) - IResource.getFileExtension() can return null - add null checks in LE.combine: for ProblemReferenceBindings, fPackage can be null - output directory can contain subdirectories with copied resources, so fall back to sources if no .class found
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathDirectory.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java3
3 files changed, 6 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 30592db960..c2a0884e19 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
@@ -359,8 +359,8 @@ ReferenceBinding askForType(PackageBinding packageBinding, char[] name, ModuleBi
private ReferenceBinding combine(ReferenceBinding one, ReferenceBinding two, ModuleBinding clientModule) {
if (one == null) return two;
if (two == null) return one;
- if (!clientModule.canAccess(one.fPackage)) return two;
- if (!clientModule.canAccess(two.fPackage)) return one;
+ if (one.fPackage == null || !clientModule.canAccess(one.fPackage)) return two;
+ if (two.fPackage == null || !clientModule.canAccess(two.fPackage)) return one;
if (one == two) return one; //$IDENTITY-COMPARISON$
return new ProblemReferenceBinding(one.compoundName, one, ProblemReasons.Ambiguous); // TODO(SHMOD): use a new problem ID
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathDirectory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathDirectory.java
index ba43b14610..623f116a66 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathDirectory.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathDirectory.java
@@ -259,7 +259,8 @@ public char[][] listPackages() {
IPath basePath = this.binaryFolder.getFullPath();
try {
this.binaryFolder.accept(r -> {
- if (r instanceof IFile && SuffixConstants.EXTENSION_class.equals(r.getFileExtension().toLowerCase())) {
+ String extension = r.getFileExtension();
+ if (r instanceof IFile && extension != null && SuffixConstants.EXTENSION_class.equals(extension.toLowerCase())) {
packageNames.add(r.getParent().getFullPath().makeRelativeTo(basePath).toString().replace('/', '.'));
}
return true;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java
index 9c6865e4a6..fd384f2459 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java
@@ -91,7 +91,8 @@ String[] directoryList(String qualifiedPackageName) {
dirList[index++] = name;
}
}
- } else {
+ }
+ if(index==0) {
container = this.sourceFolder.findMember(qualifiedPackageName);
if (container instanceof IContainer) {
members = ((IContainer) container).members();

Back to the top