--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Tue Nov 01 17:29:49 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Wed Nov 02 10:49:15 2016 +0530
@@ -161,6 +161,7 @@
private static final String POST_PROCESS = "--post-process-path";
private Layer pluginsLayer = Layer.boot();
+ private final List<Plugin> plugins;
private String lastSorter;
private boolean listPlugins;
private Path existingImage;
@@ -184,9 +185,10 @@
pluginsLayer = createPluginsLayer(paths);
}
+ plugins = PluginRepository.getPlugins(pluginsLayer);
+
Set<String> optionsSeen = new HashSet<>();
- for (Plugin plugin : PluginRepository.
- getPlugins(pluginsLayer)) {
+ for (Plugin plugin : plugins) {
if (!Utils.isDisabled(plugin)) {
addOrderedPluginOptions(plugin, optionsSeen);
}
@@ -198,6 +200,16 @@
},
"--plugin-module-path"));
mainOptions.add(new PlugOption(true, (task, opt, arg) -> {
+ for (Plugin plugin : plugins) {
+ if (plugin.getName().equals(arg)) {
+ pluginToMaps.remove(plugin);
+ return;
+ }
+ }
+ throw newBadArgs("err.no.such.plugin", arg);
+ },
+ "--disable-plugin"));
+ mainOptions.add(new PlugOption(true, (task, opt, arg) -> {
Path path = Paths.get(arg);
if (!Files.exists(path) || !Files.isDirectory(path)) {
throw newBadArgs("err.existing.image.must.exist");