diff options
author | Jay Arthanareeswaran | 2019-02-27 10:22:11 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2019-03-04 04:29:00 +0000 |
commit | 3325ba8a5c8f5838e0a099c7cdf97d24854143fd (patch) | |
tree | 582f3b65c928d7b0a67aa82c966abcccc60eb799 | |
parent | 348aad642ce79be7112961b7d8acaa520a45e279 (diff) | |
download | eclipse.jdt.core-3325ba8a5c8f5838e0a099c7cdf97d24854143fd.tar.gz eclipse.jdt.core-3325ba8a5c8f5838e0a099c7cdf97d24854143fd.tar.xz eclipse.jdt.core-3325ba8a5c8f5838e0a099c7cdf97d24854143fd.zip |
Bug 544860: Creating a new Java Project gives a build errorI20190306-2135I20190306-1800I20190306-0600I20190305-1800I20190305-0600I20190304-1800I20190304-0600
Change-Id: I72b85041530a75f7b3f277738e68e1c025e4ae96
Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
7 files changed, 37 insertions, 6 deletions
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/util/JrtFileSystem.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/util/JrtFileSystem.java index c54b616aec..b23b9f4192 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/util/JrtFileSystem.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/util/JrtFileSystem.java @@ -93,7 +93,11 @@ public class JrtFileSystem extends Archive { @Override public FileVisitResult visitModule(Path mod) throws IOException { - JrtFileSystem.this.modulePathMap.put(mod.getFileName().toString(), mod); + String name = mod.getFileName().toString(); + if (name.endsWith("/")) { //$NON-NLS-1$ + name = name.substring(0, name.length() - 1); + } + JrtFileSystem.this.modulePathMap.put(name, mod); return FileVisitResult.CONTINUE; } }, JRTUtil.NOTIFY_MODULES); diff --git a/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/JrtFileSystem.java b/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/JrtFileSystem.java index 07cadc27fb..57e6bd9a82 100644 --- a/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/JrtFileSystem.java +++ b/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/JrtFileSystem.java @@ -93,7 +93,11 @@ public class JrtFileSystem extends Archive { @Override public FileVisitResult visitModule(Path mod) throws IOException { - JrtFileSystem.this.modulePathMap.put(mod.getFileName().toString(), mod); + String name = mod.getFileName().toString(); + if (name.endsWith("/")) { //$NON-NLS-1$ + name = name.substring(0, name.length() - 1); + } + JrtFileSystem.this.modulePathMap.put(name, mod); return FileVisitResult.CONTINUE; } }, JRTUtil.NOTIFY_MODULES); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java index f6903f814f..51bfc33171 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java @@ -254,6 +254,9 @@ class JrtFileSystemWithOlderRelease extends JrtFileSystem { try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(releasePath)) { for (final java.nio.file.Path subdir: stream) { String r = subdir.getFileName().toString(); + if (r.endsWith("/")) { //$NON-NLS-1$ + r = r.substring(0, r.length() - 1); + } if (r.contains(this.releaseInHex)) { sub.add(r); } else { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java index 301df83247..45cd6edb15 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java @@ -936,7 +936,11 @@ public class JavaProject @Override public FileVisitResult visitModule(java.nio.file.Path mod) throws IOException { - JrtPackageFragmentRoot root = new JrtPackageFragmentRoot(imagePath, mod.toString(), JavaProject.this); + String name = mod.toString(); + if (name.endsWith("/")) { //$NON-NLS-1$ + name = name.substring(0, name.length() - 1); + } + JrtPackageFragmentRoot root = new JrtPackageFragmentRoot(imagePath, name, JavaProject.this); roots.add(root); if (rootToResolvedEntries != null) rootToResolvedEntries.put(root, ((ClasspathEntry)resolvedEntry).combineWith((ClasspathEntry) referringEntry)); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java index cd3e8158c8..93c178155b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java @@ -79,7 +79,11 @@ public class JrtPackageFragmentRoot extends JarPackageFragmentRoot implements IM @Override public FileVisitResult visitModule(Path mod) throws IOException { - if (!JrtPackageFragmentRoot.this.moduleName.equals(mod.toString())) { + String name = mod.toString(); + if (name.endsWith("/")) { //$NON-NLS-1$ + name = name.substring(0, name.length() - 1); + } + if (!JrtPackageFragmentRoot.this.moduleName.equals(name)) { return FileVisitResult.SKIP_SUBTREE; } return FileVisitResult.CONTINUE; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java index 50cfd275f1..7f7a9f4398 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java @@ -106,6 +106,9 @@ static HashMap<String, SimpleSet> findPackagesInModules(final ClasspathJrt jrt) } this.packageSet = new SimpleSet(41); this.packageSet.add(""); //$NON-NLS-1$ + if (name.endsWith("/")) { //$NON-NLS-1$ + name = name.substring(0, name.length() - 1); + } packagesInModule.put(name, this.packageSet); return FileVisitResult.CONTINUE; } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java index a5d8446c37..6207656dc3 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java @@ -92,8 +92,11 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt { private boolean isJRE12Plus(Path path) { try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(path)) { for (final java.nio.file.Path subdir : stream) { - String rel = subdir.getFileName().toString(); - if (Files.exists(this.fs.getPath(rel, "system-modules"))) { //$NON-NLS-1$ + if (Files.exists(subdir.resolve("system-modules"))) { //$NON-NLS-1$ + String rel = subdir.getFileName().toString(); + if (rel.endsWith("/")) { //$NON-NLS-1$ + rel = rel.substring(0, rel.length() - 1); + } int parseInt = Integer.parseInt(rel, 16); return (parseInt > 11); } @@ -155,6 +158,9 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt { try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(releasePath)) { for (final java.nio.file.Path subdir : stream) { String rel = subdir.getFileName().toString(); + if (rel.endsWith("/")) { //$NON-NLS-1$ + rel = rel.substring(0, rel.length() - 1); + } if (rel.contains(this.releaseInHex)) { sub.add(rel); } else { @@ -205,6 +211,9 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt { String name = mod.getName(1).toString(); this.packageSet = new SimpleSet(41); this.packageSet.add(""); //$NON-NLS-1$ + if (name.endsWith("/")) { //$NON-NLS-1$ + name = name.substring(0, name.length() - 1); + } packagesInModule.put(name, this.packageSet); return FileVisitResult.CONTINUE; } |