< prev index next >
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Print this page
@@ -51,11 +51,13 @@
import jdk.tools.jlink.internal.TaskHelper.OptionsHelper;
import jdk.tools.jlink.internal.ImagePluginStack.ImageProvider;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.builder.DefaultImageBuilder;
import jdk.tools.jlink.plugin.Plugin;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.module.Checks;
+import jdk.internal.module.ModulePath;
+import jdk.internal.module.ModuleResolution;
/**
* Implementation for the jlink tool.
*
* ## Should use jdk.joptsimple some day.
@@ -258,11 +260,12 @@
ImageProvider imageProvider =
createImageProvider(finder,
config.getModules(),
config.getByteOrder(),
null,
- IGNORE_SIGNING_DEFAULT);
+ IGNORE_SIGNING_DEFAULT,
+ null);
// Then create the Plugin Stack
ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(plugins);
//Ask the stack to proceed;
@@ -326,11 +329,12 @@
// First create the image provider
ImageProvider imageProvider = createImageProvider(finder,
roots,
options.endian,
options.packagedModulesPath,
- options.ignoreSigning);
+ options.ignoreSigning,
+ log);
// Then create the Plugin Stack
ImagePluginStack stack = ImagePluginConfiguration.
parseConfiguration(taskHelper.getPluginsConfig(options.output));
@@ -342,13 +346,11 @@
* Returns a module finder to find the observable modules specified in
* the --module-path and --limit-modules options
*/
private ModuleFinder modulePathFinder() {
Path[] entries = options.modulePath.toArray(new Path[0]);
- ModuleFinder finder = SharedSecrets.getJavaLangModuleAccess()
- .newModulePath(Runtime.version(), true, entries);
-
+ ModuleFinder finder = new ModulePath(Runtime.version(), true, entries);
if (!options.limitMods.isEmpty()) {
finder = limitFinder(finder, options.limitMods, Collections.emptySet());
}
return finder;
}
@@ -362,12 +364,11 @@
public static ModuleFinder newModuleFinder(List<Path> paths,
Set<String> limitMods,
Set<String> roots)
{
Path[] entries = paths.toArray(new Path[0]);
- ModuleFinder finder = SharedSecrets.getJavaLangModuleAccess()
- .newModulePath(Runtime.version(), true, entries);
+ ModuleFinder finder = new ModulePath(Runtime.version(), true, entries);
// if limitmods is specified then limit the universe
if (!limitMods.isEmpty()) {
finder = limitFinder(finder, limitMods, roots);
}
@@ -384,11 +385,12 @@
private static ImageProvider createImageProvider(ModuleFinder finder,
Set<String> roots,
ByteOrder order,
Path retainModulesPath,
- boolean ignoreSigning)
+ boolean ignoreSigning,
+ PrintWriter log)
throws IOException
{
if (roots.isEmpty()) {
throw new IllegalArgumentException("empty modules and limitmods");
}
@@ -396,10 +398,31 @@
Configuration cf = Configuration.empty()
.resolveRequires(finder,
ModuleFinder.of(),
roots);
+ // emit warning for modules that end with a digit
+ cf.modules().stream()
+ .map(ResolvedModule::name)
+ .filter(mn -> !Checks.hasLegalModuleNameLastCharacter(mn))
+ .forEach(mn -> System.err.println("WARNING: Module name \""
+ + mn + "\" may soon be illegal"));
+
+ // emit a warning for any incubating modules in the configuration
+ if (log != null) {
+ String im = cf.modules()
+ .stream()
+ .map(ResolvedModule::reference)
+ .filter(ModuleResolution::hasIncubatingWarning)
+ .map(ModuleReference::descriptor)
+ .map(ModuleDescriptor::name)
+ .collect(Collectors.joining(", "));
+
+ if (!"".equals(im))
+ log.println("WARNING: using incubating module(s): " + im);
+ }
+
Map<String, Path> mods = cf.modules().stream()
.collect(Collectors.toMap(ResolvedModule::name, JlinkTask::toPathLocation));
return new ImageHelper(cf, mods, order, retainModulesPath, ignoreSigning);
}
< prev index next >