changeset 58950:396847fd70fd

8243117: Cleanups in Java code of module jdk.jlink Reviewed-by: redestad, alanb
author clanger
date Thu, 23 Apr 2020 11:56:45 +0200
parents df5a2fb15971
children 288798de1e73
files src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/BasicImageWriter.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Main.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModularJarArchive.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolConfiguration.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/AddOptionsPlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/AddResourcePlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeJmodSectionPlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolBuilder.java src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java src/jdk.jlink/share/classes/jdk/tools/jmod/Main.java
diffstat 28 files changed, 74 insertions(+), 197 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -162,7 +162,6 @@
     private static final int EXIT_OK = 0;        // No errors.
     private static final int EXIT_ERROR = 1;     // Completed but reported errors.
     private static final int EXIT_CMDERR = 2;    // Bad command-line arguments and/or switches.
-    private static final int EXIT_SYSERR = 3;    // System error or resource exhaustion.
     private static final int EXIT_ABNORMAL = 4;  // Terminated abnormally.
 
     int run(String[] args) {
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,15 +29,11 @@
 import java.io.BufferedWriter;
 import java.io.ByteArrayInputStream;
 import java.io.DataOutputStream;
-import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.UncheckedIOException;
-import java.io.Writer;
 import java.lang.module.ModuleDescriptor;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.FileAlreadyExistsException;
@@ -55,16 +51,19 @@
 import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
-import static java.util.stream.Collectors.*;
 
 import jdk.tools.jlink.internal.BasicImageWriter;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.internal.Platform;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePoolEntry.Type;
 import jdk.tools.jlink.plugin.ResourcePoolModule;
-import jdk.tools.jlink.plugin.PluginException;
+
+import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.mapping;
+import static java.util.stream.Collectors.toSet;
 
 /**
  *
@@ -441,13 +440,6 @@
         Files.copy(in, dstFile);
     }
 
-    private void writeSymEntry(Path dstFile, Path target) throws IOException {
-        Objects.requireNonNull(dstFile);
-        Objects.requireNonNull(target);
-        Files.createDirectories(Objects.requireNonNull(dstFile.getParent()));
-        Files.createLink(dstFile, target);
-    }
-
     /*
      * Create a symbolic link to the given target if the target platform
      * supports symbolic link; otherwise, it will create a tiny file
@@ -515,13 +507,6 @@
         }
     }
 
-    private static void createUtf8File(File file, String content) throws IOException {
-        try (OutputStream fout = new FileOutputStream(file);
-                Writer output = new OutputStreamWriter(fout, "UTF-8")) {
-            output.write(content);
-        }
-    }
-
     @Override
     public ExecutableImage getExecutableImage() {
         return new DefaultExecutableImage(root, modules);
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/BasicImageWriter.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/BasicImageWriter.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,6 @@
 public final class BasicImageWriter {
     public static final String MODULES_IMAGE_NAME = "modules";
 
-    private final static int RETRY_LIMIT = 1000;
-
     private ByteOrder byteOrder;
     private ImageStringsWriter strings;
     private int length;
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,8 +75,6 @@
         }
     }
 
-    private static final String MODULE_INFO = "module-info.class";
-
     private final Path dirPath;
     private final String moduleName;
     private final List<InputStream> open = new ArrayList<>();
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,17 +25,16 @@
 package jdk.tools.jlink.internal;
 
 import java.io.DataOutputStream;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
+
 import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.Plugin.Category;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.Plugin.Category;
 import jdk.tools.jlink.plugin.ResourcePool;
 
 /**
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,30 +28,19 @@
 import java.io.IOException;
 import java.lang.module.ModuleDescriptor;
 import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import jdk.internal.jimage.decompressor.Decompressor;
 import jdk.internal.module.ModuleInfo.Attributes;
 import jdk.internal.module.ModuleTarget;
+import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePoolModule;
-import jdk.tools.jlink.plugin.ResourcePoolEntry;
-import jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl;
 
 /**
  * Plugins Stack. Plugins entry point to apply transformations onto resources
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,9 +27,7 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
 import java.nio.ByteOrder;
-import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -37,10 +35,9 @@
 import java.util.Objects;
 import java.util.Set;
 
-import jdk.internal.module.ModulePath;
+import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.builder.ImageBuilder;
 
 /**
  * API to call jlink.
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,6 @@
             // So, clear previous values, if any.
             task.options.modulePath.clear();
             String[] dirs = arg.split(File.pathSeparator);
-            int i = 0;
             Arrays.stream(dirs)
                   .map(Paths::get)
                   .forEach(task.options.modulePath::add);
@@ -734,36 +733,6 @@
         return sb.toString();
     }
 
-    private static String getBomHeader() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("#").append(new Date()).append("\n");
-        sb.append("#Please DO NOT Modify this file").append("\n");
-        return sb.toString();
-    }
-
-    private String genBOMContent() throws IOException {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getBomHeader());
-        StringBuilder command = new StringBuilder();
-        for (String c : optionsHelper.getInputCommand()) {
-            command.append(c).append(" ");
-        }
-        sb.append("command").append(" = ").append(command);
-        sb.append("\n");
-
-        return sb.toString();
-    }
-
-    private static String genBOMContent(JlinkConfiguration config,
-            PluginsConfiguration plugins)
-            throws IOException {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getBomHeader());
-        sb.append(config);
-        sb.append(plugins);
-        return sb.toString();
-    }
-
     private static class ImageHelper implements ImageProvider {
         final ByteOrder order;
         final Path packagedModulesPath;
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Main.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Main.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,10 +55,12 @@
     }
 
     public static class JlinkToolProvider implements ToolProvider {
+        @Override
         public String name() {
             return "jlink";
         }
 
+        @Override
         public int run(PrintWriter out, PrintWriter err, String... args) {
             return Main.run(out, err, args);
         }
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModularJarArchive.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModularJarArchive.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
 public class ModularJarArchive extends JarArchive {
 
     private static final String JAR_EXT = ".jar";
-    private static final String MODULE_INFO = "module-info.class";
 
     public ModularJarArchive(String mn, Path jmod, Runtime.Version version) {
         super(mn, jmod, version);
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java	Thu Apr 23 11:56:45 2020 +0200
@@ -114,7 +114,6 @@
             ModuleLayer pluginsLayer) {
         Objects.requireNonNull(name);
         Objects.requireNonNull(pluginsLayer);
-        @SuppressWarnings("unchecked")
         T provider = null;
         List<T> javaProviders = getPlugins(clazz, pluginsLayer);
         for(T factory : javaProviders) {
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolConfiguration.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolConfiguration.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,18 +30,13 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.nio.ByteBuffer;
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
-import jdk.tools.jlink.plugin.PluginException;
+
 import jdk.tools.jlink.plugin.ResourcePool;
-import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePoolModule;
 
 final class ResourcePoolConfiguration {
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,8 +65,6 @@
     public static final String JLINK_BUNDLE = "jdk.tools.jlink.resources.jlink";
     public static final String JIMAGE_BUNDLE = "jdk.tools.jimage.resources.jimage";
 
-    private static final String DEFAULTS_PROPERTY = "jdk.jlink.defaults";
-
     public final class BadArgs extends Exception {
 
         static final long serialVersionUID = 8765093759964640721L;
@@ -206,16 +204,17 @@
     }
 
     private static class PluginOption extends Option<PluginsHelper> {
-        public PluginOption(boolean hasArg,
-                Processing<PluginsHelper> processing, boolean hidden, String name, String shortname) {
+        public PluginOption(boolean hasArg, Processing<PluginsHelper> processing,
+                            boolean hidden, String name, String shortname) {
             super(hasArg, processing, hidden, name, shortname, false);
         }
 
-        public PluginOption(boolean hasArg,
-                Processing<PluginsHelper> processing, boolean hidden, String name) {
+        public PluginOption(boolean hasArg, Processing<PluginsHelper> processing,
+                            boolean hidden, String name) {
             super(hasArg, processing, hidden, name, "", false);
         }
 
+        @Override
         public String resourcePrefix() {
             return "plugin.opt.";
         }
@@ -510,26 +509,10 @@
             this.options = options;
         }
 
-        private boolean hasArgument(String optionName) throws BadArgs {
-            Option<?> opt = getOption(optionName);
-            if (opt == null) {
-                opt = pluginOptions.getOption(optionName);
-                if (opt == null) {
-                    throw new BadArgs("err.unknown.option", optionName).
-                            showUsage(true);
-                }
-            }
-            return opt.hasArg;
-        }
-
         public boolean shouldListPlugins() {
             return pluginOptions.listPlugins;
         }
 
-        private String getPluginsPath(String[] args) throws BadArgs {
-            return null;
-        }
-
         /**
          * Handles all options.  This method stops processing the argument
          * at the first non-option argument i.e. not starts with `-`, or
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,8 +34,8 @@
 import java.util.Comparator;
 import java.util.List;
 import java.util.stream.Collectors;
+
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.Plugin.Category;
 
 public class Utils {
 
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/AddOptionsPlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/AddOptionsPlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,6 @@
 
 package jdk.tools.jlink.internal.plugins;
 
-import java.io.*;
-import java.nio.charset.*;
-import java.util.*;
-import java.util.function.*;
-import java.util.stream.*;
-import jdk.tools.jlink.plugin.*;
-
 /**
  * Plugin to add VM command-line options, by storing them in a resource
  * that's read by the VM at startup
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/AddResourcePlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/AddResourcePlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,14 @@
 
 package jdk.tools.jlink.internal.plugins;
 
-import java.io.*;
-import java.nio.charset.*;
-import java.util.*;
-import java.util.function.*;
-import java.util.stream.*;
-import jdk.tools.jlink.plugin.*;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+import java.util.function.Function;
+
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 /**
  * Base plugin to add a resource
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeJmodSectionPlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeJmodSectionPlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.util.Set;
 
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.ResourcePoolEntry.Type;
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,11 +38,11 @@
 
 import jdk.tools.jlink.internal.Platform;
 import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePoolModule;
-import jdk.tools.jlink.plugin.ResourcePoolEntry;
-import jdk.tools.jlink.plugin.PluginException;
 
 /**
  *
@@ -103,7 +103,6 @@
      */
     private List<ResourcePoolEntry> getVMs(ResourcePoolModule javaBase, String[] jvmlibs) {
         List<ResourcePoolEntry> ret = javaBase.entries().filter((t) -> {
-            String path = t.path();
             for (String jvmlib : jvmlibs) {
                 if (t.path().endsWith("/" + jvmlib)) {
                     return true;
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,13 +37,14 @@
 import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.stream.Stream;
+
+import jdk.internal.access.JavaLangInvokeAccess;
 import jdk.internal.access.SharedSecrets;
-import jdk.internal.access.JavaLangInvokeAccess;
-import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
-import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 /**
  * Plugin to generate java.lang.invoke classes.
@@ -289,7 +290,6 @@
         return out.build();
     }
 
-    @SuppressWarnings("unchecked")
     private void generateBMHClass(String types, ResourcePoolBuilder out) {
         try {
             // Generate class
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -283,7 +283,6 @@
     }
 
     private boolean stripUnsupportedLocales(byte[] bytes, ClassReader cr) {
-        char[] buf = new char[cr.getMaxStringLength()];
         boolean[] modified = new boolean[1];
 
         IntStream.range(1, cr.getItemCount())
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,12 +35,12 @@
 import java.util.List;
 import java.util.Map;
 import java.util.function.ToIntFunction;
-import jdk.tools.jlink.plugin.PluginException;
+
+import jdk.tools.jlink.internal.Utils;
+import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
-import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.internal.Utils;
 
 /**
  *
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -442,6 +442,7 @@
                                                  int flags,
                                                  String version) {
                     return new ModuleVisitor(Opcodes.ASM7) {
+                        @Override
                         public void visitPackage(String pn) {
                             packages.add(pn);
                         }
@@ -1708,6 +1709,7 @@
             /**
              * Loads an Enum field.
              */
+            @Override
             void visitElement(T t, MethodVisitor mv) {
                 mv.visitFieldInsn(GETSTATIC, className, t.toString(),
                                   "L" + className + ";");
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,10 @@
  */
 package jdk.tools.jlink.plugin;
 
-import java.util.Collections;
 import java.util.EnumSet;
 import java.util.Map;
 import java.util.Set;
+
 import jdk.tools.jlink.internal.plugins.PluginsResourceBundle;
 
 /**
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 package jdk.tools.jlink.plugin;
 
 import java.nio.ByteOrder;
-import java.util.Map;
 import java.util.Optional;
 import java.util.function.Function;
 import java.util.stream.Stream;
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolBuilder.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolBuilder.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,6 @@
  */
 package jdk.tools.jlink.plugin;
 
-import java.nio.ByteOrder;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Function;
-import java.util.stream.Stream;
-
 /**
  * Resource pool builder to build a resource pool by incrementally
  * adding a set of resources one at a time.
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Stream;
-import jdk.internal.module.ModuleTarget;
 
 /**
   * Link-time representation of a module.
--- a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Thu Apr 23 11:56:45 2020 +0200
@@ -35,53 +35,30 @@
 import java.io.UncheckedIOException;
 import java.lang.module.Configuration;
 import java.lang.module.FindException;
-import java.lang.module.ModuleReader;
-import java.lang.module.ModuleReference;
-import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Exports;
 import java.lang.module.ModuleDescriptor.Opens;
 import java.lang.module.ModuleDescriptor.Provides;
-import java.lang.module.ModuleDescriptor.Requires;
 import java.lang.module.ModuleDescriptor.Version;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReader;
+import java.lang.module.ModuleReference;
 import java.lang.module.ResolutionException;
 import java.lang.module.ResolvedModule;
 import java.net.URI;
-import java.nio.file.FileSystems;
-import java.nio.file.FileVisitOption;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.InvalidPathException;
-import java.nio.file.Path;
-import java.nio.file.PathMatcher;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.StandardCopyOption;
+import java.nio.file.*;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.Optional;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
 import java.util.function.Consumer;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
-import java.util.stream.Collectors;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
+import java.util.stream.Collectors;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
--- a/src/jdk.jlink/share/classes/jdk/tools/jmod/Main.java	Thu Apr 23 16:36:05 2020 +0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/Main.java	Thu Apr 23 11:56:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,10 +50,12 @@
     }
 
     public static class JmodToolProvider implements ToolProvider {
+        @Override
         public String name() {
             return "jmod";
         }
 
+        @Override
         public int run(PrintWriter out, PrintWriter err, String... args) {
             return Main.run(out, err, args);
         }