8159593: Plugin Set<Category> getType() should return a Category
authorsundar
Tue, 21 Jun 2016 19:05:34 +0530
changeset 39129 4b2086305b68
parent 39128 e991a1c8b41b
child 39130 bb2660863cbf
8159593: Plugin Set<Category> getType() should return a Category Reviewed-by: jlaskey
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java
jdk/test/tools/jlink/DefaultProviderTest.java
jdk/test/tools/jlink/IntegrationTest.java
jdk/test/tools/jlink/JLinkOptimTest.java
jdk/test/tools/jlink/JLinkPostProcessingTest.java
jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java
jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java
jdk/test/tools/jlink/plugins/LastSorterTest.java
jdk/test/tools/jlink/plugins/PluginOrderTest.java
jdk/test/tools/jlink/plugins/PluginsNegativeTest.java
jdk/test/tools/jlink/plugins/PrevisitorTest.java
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Tue Jun 21 19:05:34 2016 +0530
@@ -101,7 +101,7 @@
             List<Plugin> orderedPlugins = PluginOrderingGraph.sort(entry.getValue());
             Category category = entry.getKey();
             for (Plugin p : orderedPlugins) {
-                if (Utils.isPostProcessor(category)) {
+                if (category.isPostProcessor()) {
                     @SuppressWarnings("unchecked")
                     PostProcessorPlugin pp = (PostProcessorPlugin) p;
                     postProcessingPlugins.add(pp);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Tue Jun 21 19:05:34 2016 +0530
@@ -35,7 +35,6 @@
 import java.util.Comparator;
 import java.util.List;
 import java.util.Objects;
-import java.util.Set;
 import java.util.stream.Collectors;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.Plugin.Category;
@@ -57,46 +56,16 @@
                      .collect(Collectors.toList());
     }
 
-    public static boolean isPostProcessor(Category category) {
-        return category.equals(Category.VERIFIER)
-                || category.equals(Category.PROCESSOR)
-                || category.equals(Category.PACKAGER);
-    }
-
-    public static boolean isPreProcessor(Category category) {
-        return category.equals(Category.COMPRESSOR)
-                || category.equals(Category.FILTER)
-                || category.equals(Category.MODULEINFO_TRANSFORMER)
-                || category.equals(Category.SORTER)
-                || category.equals(Category.TRANSFORMER)
-                || category.equals(Category.METAINFO_ADDER);
-    }
-
     public static boolean isPostProcessor(Plugin provider) {
-        Set<Category> types = provider.getType();
-        Objects.requireNonNull(types);
-        for (Category pt : types) {
-            return isPostProcessor(pt);
-        }
-        return false;
+        return provider.getType().isPostProcessor();
     }
 
     public static boolean isPreProcessor(Plugin provider) {
-        Set<Category> types = provider.getType();
-        Objects.requireNonNull(types);
-        for (Category pt : types) {
-            return isPreProcessor(pt);
-        }
-        return false;
+        return !isPostProcessor(provider);
     }
 
     public static Category getCategory(Plugin provider) {
-        Set<Category> types = provider.getType();
-        Objects.requireNonNull(types);
-        for (Category t : types) {
-            return t;
-        }
-        return null;
+        return provider.getType();
     }
 
     public static List<Plugin> getPreProcessors(List<Plugin> plugins) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -25,9 +25,7 @@
 package jdk.tools.jlink.internal.plugins;
 
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 
 import jdk.tools.jlink.internal.ModulePoolImpl;
 import jdk.tools.jlink.plugin.ModulePool;
@@ -77,10 +75,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.COMPRESSOR);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.COMPRESSOR;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -26,9 +26,7 @@
 
 import java.io.UncheckedIOException;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 import java.util.function.Predicate;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.plugin.ModulePool;
@@ -60,10 +58,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.FILTER);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.FILTER;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -25,9 +25,7 @@
 package jdk.tools.jlink.internal.plugins;
 
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 import java.util.function.Predicate;
 import jdk.tools.jlink.plugin.TransformerPlugin;
 import jdk.tools.jlink.plugin.ModuleEntry;
@@ -73,10 +71,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.FILTER);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.FILTER;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -32,10 +32,8 @@
 import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.TreeSet;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
@@ -159,10 +157,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.FILTER);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.FILTER;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -36,11 +36,9 @@
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Set;
 import jdk.tools.jlink.internal.ModuleEntryImpl;
 import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ModuleEntry;
@@ -188,13 +186,6 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.TRANSFORMER);
-        return Collections.unmodifiableSet(set);
-    }
-
-    @Override
     public void configure(Map<String, String> config) {
         List<String> arguments = Utils.parseList(config.get(NAME));
         if (arguments.isEmpty()) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -61,11 +61,6 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        return Collections.singleton(Category.TRANSFORMER);
-    }
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -27,7 +27,6 @@
 import java.io.ByteArrayInputStream;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.IllformedLocaleException;
 import java.util.Locale;
 import java.util.List;
@@ -134,10 +133,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.FILTER);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.FILTER;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -31,7 +31,6 @@
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -284,11 +283,4 @@
             }
         }
     }
-
-    @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.TRANSFORMER);
-        return Collections.unmodifiableSet(set);
-    }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -32,7 +32,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -143,11 +142,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.SORTER);
-
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.SORTER;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -49,8 +49,8 @@
     private final Map<String, String> release = new HashMap<>();
 
     @Override
-    public Set<Category> getType() {
-        return Collections.singleton(Category.METAINFO_ADDER);
+    public Category getType() {
+        return Category.METAINFO_ADDER;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -343,10 +343,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.COMPRESSOR);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.COMPRESSOR;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -27,8 +27,6 @@
 import java.io.ByteArrayInputStream;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
 import java.util.function.Predicate;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassWriter;
@@ -58,13 +56,6 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.TRANSFORMER);
-        return Collections.unmodifiableSet(set);
-    }
-
-    @Override
     public String getDescription() {
         return PluginsResourceBundle.getDescription(NAME);
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -25,8 +25,6 @@
 package jdk.tools.jlink.internal.plugins;
 
 import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
 import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
@@ -45,10 +43,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.FILTER);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.FILTER;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -83,11 +83,6 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        return Collections.singleton(Category.TRANSFORMER);
-    }
-
-    @Override
     public String getName() {
         return NAME;
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -29,9 +29,7 @@
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 import java.util.function.Predicate;
 import java.util.zip.Deflater;
 import jdk.tools.jlink.internal.ModulePoolImpl;
@@ -66,10 +64,8 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.COMPRESSOR);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.COMPRESSOR;
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -57,19 +57,29 @@
         SORTER("SORTER"),
         COMPRESSOR("COMPRESSOR"),
         METAINFO_ADDER("METAINFO_ADDER"),
-        VERIFIER("VERIFIER"),
-        PROCESSOR("PROCESSOR"),
-        PACKAGER("PACKAGER");
+        VERIFIER("VERIFIER", true),
+        PROCESSOR("PROCESSOR", true),
+        PACKAGER("PACKAGER", true);
 
         private final String name;
+        private final boolean postProcessor;
+
+        Category(String name, boolean postProcessor) {
+            this.name = name;
+            this.postProcessor = postProcessor;
+        }
 
         Category(String name) {
-            this.name = name;
+            this(name, false);
         }
 
         public String getName() {
             return name;
         }
+
+        public boolean isPostProcessor() {
+            return postProcessor;
+        }
     }
 
     /**
@@ -90,11 +100,12 @@
     }
 
     /**
-     * The Plugin set of types.
-     * @return The set of types.
+     * The type of this plugin.
+     *
+     * @return The type of this plugin
      */
-    public default Set<Category> getType() {
-        return Collections.emptySet();
+    public default Category getType() {
+        return Category.TRANSFORMER;
     }
 
     /**
--- a/jdk/test/tools/jlink/DefaultProviderTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/DefaultProviderTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -26,7 +26,6 @@
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -65,13 +64,6 @@
         private boolean enabled = true;
 
         @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.TRANSFORMER);
-            return Collections.unmodifiableSet(set);
-        }
-
-        @Override
         public Set<State> getState() {
              return enabled ? EnumSet.of(State.AUTO_ENABLED, State.FUNCTIONAL)
                 : EnumSet.of(State.DISABLED);
--- a/jdk/test/tools/jlink/IntegrationTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/IntegrationTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -90,10 +90,8 @@
         }
 
         @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.PROCESSOR);
-            return Collections.unmodifiableSet(set);
+        public Category getType() {
+            return Category.PROCESSOR;
         }
 
         @Override
@@ -139,13 +137,6 @@
         }
 
         @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.TRANSFORMER);
-            return Collections.unmodifiableSet(set);
-        }
-
-        @Override
         public String getDescription() {
             return null;
         }
--- a/jdk/test/tools/jlink/JLinkOptimTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/JLinkOptimTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -9,11 +9,9 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.stream.Stream;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.Opcodes;
@@ -132,13 +130,6 @@
         public String getName() {
             return NAME;
         }
-
-        @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.TRANSFORMER);
-            return Collections.unmodifiableSet(set);
-        }
     }
 
     private static void testForName() throws Exception {
--- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -26,10 +26,8 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.plugin.ExecutableImage;
@@ -75,10 +73,8 @@
         }
 
         @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.PROCESSOR);
-            return Collections.unmodifiableSet(set);
+        public Category getType() {
+            return Category.PROCESSOR;
         }
 
         @Override
--- a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -23,9 +23,7 @@
 package plugin;
 
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.ModulePool;
@@ -58,9 +56,7 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.PROCESSOR);
-        return Collections.unmodifiableSet(set);
+    public Category getType() {
+        return Category.PROCESSOR;
     }
 }
--- a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java	Tue Jun 21 19:05:34 2016 +0530
@@ -26,9 +26,7 @@
 import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 import jdk.tools.jlink.plugin.ModuleEntry;
 import jdk.tools.jlink.plugin.ModulePool;
 import jdk.tools.jlink.plugin.TransformerPlugin;
@@ -63,13 +61,6 @@
     }
 
     @Override
-    public Set<Category> getType() {
-        Set<Category> set = new HashSet<>();
-        set.add(Category.TRANSFORMER);
-        return Collections.unmodifiableSet(set);
-    }
-
-    @Override
     public String getDescription() {
         return NAME + "-description";
     }
--- a/jdk/test/tools/jlink/plugins/LastSorterTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -33,10 +33,8 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
@@ -200,13 +198,6 @@
         }
 
         @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.TRANSFORMER);
-            return Collections.unmodifiableSet(set);
-        }
-
-        @Override
         public void configure(Map<String, String> config) {
             String arguments = config.get(name);
             this.starts = arguments;
--- a/jdk/test/tools/jlink/plugins/PluginOrderTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/plugins/PluginOrderTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -260,8 +260,8 @@
         }
 
         @Override
-        public Set<Category> getType() {
-            return Collections.singleton(category);
+        public Category getType() {
+            return category;
         }
 
         @Override
--- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -32,10 +32,8 @@
 import java.lang.reflect.Layer;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
@@ -138,13 +136,6 @@
         }
 
         @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.TRANSFORMER);
-            return Collections.unmodifiableSet(set);
-        }
-
-        @Override
         public String getDescription() {
             return null;
         }
--- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java	Tue Jun 21 14:00:59 2016 +0100
+++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java	Tue Jun 21 19:05:34 2016 +0530
@@ -34,11 +34,9 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-import java.util.Set;
 import java.util.stream.Collectors;
 
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
@@ -160,12 +158,5 @@
                 }
             });
         }
-
-        @Override
-        public Set<Category> getType() {
-            Set<Category> set = new HashSet<>();
-            set.add(Category.TRANSFORMER);
-            return Collections.unmodifiableSet(set);
-        }
     }
 }