--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Mon Feb 16 19:14:18 2015 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Tue Feb 17 15:39:05 2015 +0100
@@ -678,29 +678,43 @@
boolean haveJImageFiles =
files.anyMatch(f -> f.getFileName().toString().endsWith(".jimage"));
if (haveJImageFiles) {
- return Collections.singleton(JRT_MARKER_FILE);
+ return addAdditionalBootEntries(Collections.singleton(JRT_MARKER_FILE));
}
}
}
- // Temporary: if no .jimage files, return individual modules
- if (Files.exists(libModules.resolve("java.base"))) {
- return Files.list(libModules)
- .map(d -> d.resolve("classes"))
- .collect(Collectors.toList());
- }
-
// Exploded module image
Path modules = Paths.get(java_home, "modules");
if (Files.isDirectory(modules.resolve("java.base"))) {
- return Files.list(modules)
- .collect(Collectors.toList());
+ try (Stream<Path> listedModules = Files.list(modules)) {
+ return addAdditionalBootEntries(listedModules.collect(Collectors.toList()));
+ }
}
// not a modular image that we know about
return null;
}
+ //ensure bootclasspath prepends/appends are reflected in the systemClasses
+ private Collection<Path> addAdditionalBootEntries(Collection<Path> modules) throws IOException {
+ String files = System.getProperty("sun.boot.class.path");
+
+ if (files == null)
+ return modules;
+
+ Set<Path> paths = new LinkedHashSet<>();
+
+ for (String s : files.split(Pattern.quote(File.pathSeparator))) {
+ if (s.endsWith(".jimage")) {
+ paths.addAll(modules);
+ } else if (!s.isEmpty()) {
+ paths.add(Paths.get(s));
+ }
+ }
+
+ return paths;
+ }
+
private void lazy() {
if (searchPath == null) {
try {