Skip to content

Commit a0732d1

Browse files
committed
Check all builderClassPathEntries for "."
1 parent fe9f91b commit a0732d1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/AbstractNativeImageClassLoaderSupport.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ protected AbstractNativeImageClassLoaderSupport(ClassLoader defaultSystemClassLo
8080

8181
imagecp = Collections.unmodifiableList(Arrays.stream(classPathClassLoader.getURLs()).map(Util::urlToPath).collect(Collectors.toList()));
8282
String builderClassPathString = System.getProperty("java.class.path");
83-
if (".".equals(builderClassPathString)) {
84-
VMError.shouldNotReachHere("Only ever run " + NativeImageGeneratorRunner.class.getName() + " with explicit --module-path and --module argument.");
85-
}
8683
String[] builderClassPathEntries = builderClassPathString.isEmpty() ? new String[0] : builderClassPathString.split(File.pathSeparator);
84+
if (Arrays.asList(builderClassPathEntries).contains(".")) {
85+
VMError.shouldNotReachHere("The classpath of " + NativeImageGeneratorRunner.class.getName() +
86+
" must not contain \".\". This can happen implicitly if the builder runs exclusively on the --module-path" +
87+
" but specifies the " + NativeImageGeneratorRunner.class.getName() + " main class without --module.");
88+
}
8789
buildcp = Collections.unmodifiableList(Arrays.stream(builderClassPathEntries)
8890
.map(Paths::get).map(Path::toAbsolutePath)
8991
.collect(Collectors.toList()));

0 commit comments

Comments
 (0)