src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
changeset 47399 fb677b3f0888
parent 47216 71c04702a3d5
child 47464 36de9c637393
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Fri Oct 20 13:33:35 2017 +0200
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Fri Oct 20 17:16:05 2017 +0530
@@ -438,6 +438,16 @@
         Configuration cf = bindService ? config.resolveAndBind()
                                        : config.resolve();
 
+        cf.modules().stream()
+            .map(ResolvedModule::reference)
+            .filter(mref -> mref.descriptor().isAutomatic())
+            .findAny()
+            .ifPresent(mref -> {
+                String loc = mref.location().map(URI::toString).orElse("<unknown>");
+                throw new IllegalArgumentException(
+                    taskHelper.getMessage("err.automatic.module", mref.descriptor().name(), loc));
+            });
+
         if (verbose && log != null) {
             // print modules to be linked in
             cf.modules().stream()