# HG changeset patch # User herrick # Date 1541097378 14400 # Node ID 5d200811530913f0df9a3aebaef4e2edd2f6b80c # Parent d3a84ae1142966fa8d0e99636145b917cd2bf484 JDK-8213244: Fix all warnings in jpackager java code Reviewed-by: almatvee diff -r d3a84ae11429 -r 5d2008115309 make/CompileJavaModules.gmk --- a/make/CompileJavaModules.gmk Thu Nov 01 09:01:15 2018 -0400 +++ b/make/CompileJavaModules.gmk Thu Nov 01 14:36:18 2018 -0400 @@ -386,7 +386,6 @@ jdk.packager_ADD_JAVAC_FLAGS += -parameters -XDstringConcat=inline -jdk.packager_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS jdk.packager_COPY += .gif .png .txt .spec .script .prerm .preinst .postrm .postinst .list \ .desktop .copyright .control .plist .template .icns .scpt .entitlements .wxs .iss .ico .bmp diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/linux/classes/jdk/packager/internal/linux/LinuxRpmBundler.java --- a/src/jdk.packager/linux/classes/jdk/packager/internal/linux/LinuxRpmBundler.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/linux/classes/jdk/packager/internal/linux/LinuxRpmBundler.java Thu Nov 01 14:36:18 2018 -0400 @@ -183,7 +183,7 @@ if (matcher.find()) { String v = matcher.group(1); - double version = new Double(v); + double version = Double.parseDouble(v); return minVersion <= version; } else { return false; diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/AbstractBundler.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/AbstractBundler.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/AbstractBundler.java Thu Nov 01 14:36:18 2018 -0400 @@ -63,7 +63,7 @@ // we use it for classpath lookup and there / are not platform specific public final static String BUNDLER_PREFIX = "package/"; - protected Class baseResourceLoader = null; + protected Class baseResourceLoader = null; protected void fetchResource(String publicName, String category, String defaultName, File result, boolean verbose, File publicRoot) diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java Thu Nov 01 14:36:18 2018 -0400 @@ -771,7 +771,6 @@ Properties properties = new Properties(); try (FileInputStream in = new FileInputStream(file)) { properties.load(in); - in.close(); } catch (IOException e) { Log.info("Exception: " + e.getMessage()); } diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/BundlerParamInfo.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/BundlerParamInfo.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/BundlerParamInfo.java Thu Nov 01 14:36:18 2018 -0400 @@ -130,7 +130,7 @@ return getStringConverter().apply((String)o, params); } - Class klass = getValueType(); + Class klass = getValueType(); if (klass.isInstance(o)) { return (T) o; } diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/ConfigException.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/ConfigException.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/ConfigException.java Thu Nov 01 14:36:18 2018 -0400 @@ -26,6 +26,7 @@ package jdk.packager.internal; public class ConfigException extends Exception { + private static final long serialVersionUID = 1L; final String advice; public ConfigException(String msg, String advice) { diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/InvalidBundlerParamException.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/InvalidBundlerParamException.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/InvalidBundlerParamException.java Thu Nov 01 14:36:18 2018 -0400 @@ -26,6 +26,7 @@ package jdk.packager.internal; public class InvalidBundlerParamException extends RuntimeException { + private static final long serialVersionUID = 1L; public InvalidBundlerParamException(String message) { super(message); } diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/JLinkBundlerHelper.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/JLinkBundlerHelper.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/JLinkBundlerHelper.java Thu Nov 01 14:36:18 2018 -0400 @@ -365,7 +365,7 @@ private static Set getResourceFileJarList( Map params, ModFile.JarType Query) { - Set files = new LinkedHashSet(); + Set files = new LinkedHashSet(); String srcdir = StandardBundlerParam.SOURCE_DIR.fetchFrom(params); @@ -404,7 +404,7 @@ private static Set removeInvalidModules( List modulePath, Set modules) { - Set result = new LinkedHashSet(); + Set result = new LinkedHashSet(); ModuleManager mm = new ModuleManager(modulePath); List lmodfiles = mm.getModules(EnumSet.of(ModuleManager.SearchType.ModularJar, @@ -484,7 +484,7 @@ } private static Set getModuleNamesFromPath(List Value) { - Set result = new LinkedHashSet(); + Set result = new LinkedHashSet(); ModuleManager mm = new ModuleManager(Value); List modFiles = mm.getModules( diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/ModuleManager.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/ModuleManager.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/ModuleManager.java Thu Nov 01 14:36:18 2018 -0400 @@ -33,14 +33,14 @@ import java.util.List; public final class ModuleManager { - private final List folders = new ArrayList(); + private final List folders = new ArrayList(); public enum SearchType {UnnamedJar, ModularJar, Jmod, ExplodedModule} public ModuleManager(String folders) { super(); String lfolders = folders.replaceAll("^\"|\"$", ""); - List paths = new ArrayList(); + List paths = new ArrayList(); for (String folder : Arrays.asList(lfolders.split(File.pathSeparator))) { @@ -69,7 +69,7 @@ } public List getModules(EnumSet Search) { - List result = new ArrayList(); + List result = new ArrayList(); for (String folder : folders) { result.addAll(getAllModulesInDirectory(folder, Search)); @@ -80,7 +80,7 @@ private static List getAllModulesInDirectory(String Folder, EnumSet Search) { - List result = new ArrayList(); + List result = new ArrayList(); File lfolder = new File(Folder); File[] files = lfolder.listFiles(); diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/PackagerException.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/PackagerException.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/PackagerException.java Thu Nov 01 14:36:18 2018 -0400 @@ -29,6 +29,7 @@ import java.util.ResourceBundle; public class PackagerException extends Exception { + private static final long serialVersionUID = 1L; private static final ResourceBundle bundle = ResourceBundle.getBundle("jdk.packager.internal.resources.Bundle"); diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/RedistributableModules.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/RedistributableModules.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/RedistributableModules.java Thu Nov 01 14:36:18 2018 -0400 @@ -99,7 +99,7 @@ } if (br != null) { - result = new LinkedHashSet(); + result = new LinkedHashSet(); String line; try { diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/SecondaryLauncherArguments.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/SecondaryLauncherArguments.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/SecondaryLauncherArguments.java Thu Nov 01 14:36:18 2018 -0400 @@ -152,14 +152,14 @@ } private void putUnlessNullOrEmpty(Map params, - String param, Collection value) { + String param, Collection value) { if (value != null && !value.isEmpty()) { params.put(param, value); } } private void putUnlessNullOrEmpty(Map params, - String param, Map value) { + String param, Map value) { if (value != null && !value.isEmpty()) { params.put(param, value); } diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/StandardBundlerParam.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/StandardBundlerParam.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/StandardBundlerParam.java Thu Nov 01 14:36:18 2018 -0400 @@ -112,7 +112,6 @@ StandardBundlerParam::createAppResourcesListFromString ); - @SuppressWarnings("unchecked") public static final StandardBundlerParam SOURCE_DIR = new StandardBundlerParam<>( I18N.getString("param.source-dir.name"), @@ -132,6 +131,7 @@ } ); + @SuppressWarnings("unchecked") public static final StandardBundlerParam> SOURCE_FILES = new StandardBundlerParam<>( I18N.getString("param.source-files.name"), @@ -544,9 +544,8 @@ if (modulePath != null) { javaBasePath = JLinkBundlerHelper .findPathOfModule(modulePath, JAVABASEJMOD); - } - else { - modulePath = new ArrayList(); + } else { + modulePath = new ArrayList(); } // Add the default JDK module path to the module path. @@ -571,7 +570,6 @@ return modulePath; }); - @SuppressWarnings("unchecked") public static final BundlerParamInfo MODULE = new StandardBundlerParam<>( I18N.getString("param.main.module.name"), @@ -590,7 +588,7 @@ I18N.getString("param.add-modules.description"), Arguments.CLIOptions.ADD_MODULES.getId(), (Class>) (Object) Set.class, - p -> new LinkedHashSet(), + p -> new LinkedHashSet(), (s, p) -> new LinkedHashSet<>(Arrays.asList(s.split(","))) ); @@ -601,11 +599,10 @@ I18N.getString("param.limit-modules.description"), Arguments.CLIOptions.LIMIT_MODULES.getId(), (Class>) (Object) Set.class, - p -> new LinkedHashSet(), + p -> new LinkedHashSet(), (s, p) -> new LinkedHashSet<>(Arrays.asList(s.split(","))) ); - @SuppressWarnings("unchecked") public static final BundlerParamInfo STRIP_NATIVE_COMMANDS = new StandardBundlerParam<>( I18N.getString("param.strip-executables.name"), @@ -869,7 +866,7 @@ } public static List getDefaultModulePath() { - List result = new ArrayList(); + List result = new ArrayList(); Path jdkModulePath = Paths.get( System.getProperty("java.home"), "jmods").toAbsolutePath(); diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/UnsupportedPlatformException.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/UnsupportedPlatformException.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/UnsupportedPlatformException.java Thu Nov 01 14:36:18 2018 -0400 @@ -26,4 +26,5 @@ package jdk.packager.internal; public class UnsupportedPlatformException extends Exception { + private static final long serialVersionUID = 1L; } diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/share/classes/jdk/packager/internal/bundlers/BundleParams.java --- a/src/jdk.packager/share/classes/jdk/packager/internal/bundlers/BundleParams.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/share/classes/jdk/packager/internal/bundlers/BundleParams.java Thu Nov 01 14:36:18 2018 -0400 @@ -475,13 +475,13 @@ } } - public void putUnlessNullOrEmpty(String param, Collection value) { + public void putUnlessNullOrEmpty(String param, Collection value) { if (value != null && !value.isEmpty()) { params.put(param, value); } } - public void putUnlessNullOrEmpty(String param, Map value) { + public void putUnlessNullOrEmpty(String param, Map value) { if (value != null && !value.isEmpty()) { params.put(param, value); } diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.jre.iss --- a/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.jre.iss Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.jre.iss Thu Nov 01 14:36:18 2018 -0400 @@ -1,14 +1,14 @@ ;This file will be executed next to the application bundle image -;I.e. current directory will contain folder APPLICATION_NAME with application files +;I.e. current directory will contain folder INSTALLER_NAME with application files [Setup] AppId={{PRODUCT_APP_IDENTIFIER}} -AppName=APPLICATION_NAME +AppName=INSTALLER_NAME AppVersion=APPLICATION_VERSION -AppVerName=APPLICATION_NAME APPLICATION_VERSION +AppVerName=INSTALLER_NAME APPLICATION_VERSION AppPublisher=APPLICATION_VENDOR AppComments=APPLICATION_COMMENTS AppCopyright=APPLICATION_COPYRIGHT -DefaultDirName=APPLICATION_INSTALL_ROOT\APPLICATION_NAME +DefaultDirName=APPLICATION_INSTALL_ROOT\INSTALLER_NAME DisableStartupPrompt=Yes DisableDirPage=DISABLE_DIR_PAGE DisableProgramGroupPage=Yes @@ -26,9 +26,9 @@ PrivilegesRequired=APPLICATION_INSTALL_PRIVILEGE SetupIconFile= UninstallDisplayIcon= -UninstallDisplayName=APPLICATION_NAME +UninstallDisplayName=INSTALLER_NAME WizardImageStretch=No -WizardSmallImageFile=APPLICATION_NAME-setup-icon.bmp +WizardSmallImageFile=INSTALLER_NAME-setup-icon.bmp ArchitecturesInstallIn64BitMode=ARCHITECTURE_BIT_MODE FILE_ASSOCIATIONS @@ -36,7 +36,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl" [Files] -Source: "APPLICATION_NAME\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "INSTALLER_NAME\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs [Code] function returnTrue(): Boolean; diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java --- a/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java Thu Nov 01 14:36:18 2018 -0400 @@ -234,7 +234,7 @@ Matcher matcher = pattern.matcher(content); if (matcher.find()) { String v = matcher.group(1); - version = new Double(v); + version = Double.parseDouble(v); } } return version; diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinMsiBundler.java --- a/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinMsiBundler.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinMsiBundler.java Thu Nov 01 14:36:18 2018 -0400 @@ -286,7 +286,7 @@ Matcher matcher = pattern.matcher(content); if (matcher.find()) { String v = matcher.group(1); - version = new Double(v); + version = Double.parseDouble(v); } } return version; diff -r d3a84ae11429 -r 5d2008115309 src/jdk.packager/windows/classes/jdk/packager/internal/windows/WindowsRegistry.java --- a/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WindowsRegistry.java Thu Nov 01 09:01:15 2018 -0400 +++ b/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WindowsRegistry.java Thu Nov 01 14:36:18 2018 -0400 @@ -76,7 +76,7 @@ } public static final List readExclusionsPaths() { - List result = new ArrayList(); + List result = new ArrayList(); final String key = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\" + "Windows Defender\\Exclusions\\Paths"; String value = readRegistry(key, "");