diff --git a/test/jdk/tools/jpackage/apps/ChildProcessAppLauncher.java b/test/jdk/tools/jpackage/apps/ChildProcessAppLauncher.java index b599488b563f1..ff471f6b91934 100644 --- a/test/jdk/tools/jpackage/apps/ChildProcessAppLauncher.java +++ b/test/jdk/tools/jpackage/apps/ChildProcessAppLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -21,9 +21,7 @@ * questions. */ -import java.io.File; import java.io.IOException; -import java.nio.file.Path; public class ChildProcessAppLauncher { public static void main(String[] args) throws IOException, InterruptedException { diff --git a/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/AnnotationsTest.java b/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/AnnotationsTest.java index 230b14fd1eac4..d439452ffa0c6 100644 --- a/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/AnnotationsTest.java +++ b/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/AnnotationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,7 +35,6 @@ import static java.util.stream.Collectors.toMap; import java.util.stream.Stream; import jdk.internal.util.OperatingSystem; -import static jdk.internal.util.OperatingSystem.LINUX; import jdk.jpackage.test.Annotations.Parameter; import jdk.jpackage.test.Annotations.ParameterSupplier; import jdk.jpackage.test.Annotations.Parameters; @@ -52,12 +51,12 @@ public class AnnotationsTest { public static void main(String... args) { - runTests(BasicTest.class, ParameterizedInstanceTest.class); + runTests(List.of(BasicTest.class, ParameterizedInstanceTest.class)); for (var os : OperatingSystem.values()) { try { TestBuilderConfig.setOperatingSystem(os); TKit.log("Current operating system: " + os); - runTests(IfOSTest.class); + runTests(List.of(IfOSTest.class)); } finally { TestBuilderConfig.setDefaults(); } @@ -301,17 +300,17 @@ public static Collection dateSupplier() { }); } - private static void runTests(Class... tests) { + private static void runTests(List> tests) { ACTUAL_TEST_DESCS.get().clear(); - var expectedTestDescs = Stream.of(tests) + var expectedTestDescs = tests.stream() .map(AnnotationsTest::getExpectedTestDescs) .flatMap(x -> x) // Collect in the map to check for collisions for free .collect(toMap(x -> x, x -> "")) .keySet(); - var args = Stream.of(tests).map(test -> { + var args = tests.stream().map(test -> { return String.format("--jpt-run=%s", test.getName()); }).toArray(String[]::new); @@ -324,6 +323,7 @@ private static void runTests(Class... tests) { } } + @SuppressWarnings("unchecked") private static Stream getExpectedTestDescs(Class type) { return toSupplier(() -> { var method = type.getMethod("getExpectedTestDescs"); diff --git a/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/DirectoryContentVerifierTest.java b/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/DirectoryContentVerifierTest.java index 79af67d3e9a3e..f74719880512f 100644 --- a/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/DirectoryContentVerifierTest.java +++ b/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/DirectoryContentVerifierTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -106,7 +106,7 @@ ArgsBuilder expectFail() { } @Parameters - public static Collection input() { + public static Collection input() { List data = new ArrayList<>(); buildArgs().applyVariantsTo(data); buildArgs().actualPaths("foo").assertOp(CONTAINS).applyTo(data); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java index 70b0e160d24cc..03914759f1662 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -87,10 +87,15 @@ public final AdditionalLauncher setLauncherAsService() { } public final AdditionalLauncher addRawProperties( - Map.Entry... v) { + Map.Entry v) { return addRawProperties(List.of(v)); } + public final AdditionalLauncher addRawProperties( + Map.Entry v, Map.Entry v2) { + return addRawProperties(List.of(v, v2)); + } + public final AdditionalLauncher addRawProperties( Collection> v) { rawProperties.addAll(v); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Comm.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Comm.java index 23762c53e2ff7..84a9eb0288592 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Comm.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Comm.java @@ -34,6 +34,6 @@ public static Comm compare(Set a, Set b) { unique1.removeAll(common); Set unique2 = new HashSet<>(b); unique2.removeAll(common); - return new Comm(common, unique1, unique2); + return new Comm(common, unique1, unique2); } } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/CommandArguments.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/CommandArguments.java index 369ee337dc843..cb7f0574afde5 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/CommandArguments.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/CommandArguments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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,17 +36,17 @@ public class CommandArguments { public final T clearArguments() { args.clear(); - return (T) this; + return thiz(); } public final T addArgument(String v) { args.add(v); - return (T) this; + return thiz(); } public final T addArguments(List v) { args.addAll(v); - return (T) this; + return thiz(); } public final T addArgument(Path v) { @@ -77,5 +77,10 @@ protected boolean isMutable() { return true; } + @SuppressWarnings("unchecked") + private T thiz() { + return (T) this; + } + protected List args; } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java index 706e26668b191..b00f72a328edd 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java @@ -259,7 +259,8 @@ Result getValue() { return value; } - private final Result value; + private final transient Result value; + private static final long serialVersionUID = 1L; } /* diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java index 28b3574268142..44427d537543e 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -47,18 +47,10 @@ public static Runnable identity(Runnable v) { return v; } - public static Function identity(Function v) { - return v; - } - public static Function identityFunction(Function v) { return v; } - public static Predicate identity(Predicate v) { - return v; - } - public static Predicate identityPredicate(Predicate v) { return v; } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java index 341362d169694..224a3f752cf3b 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java @@ -393,7 +393,7 @@ public AppOutputVerifier addParams(Map v) { return addParams(v.entrySet()); } - public AppOutputVerifier addParams(Map.Entry... v) { + public AppOutputVerifier addParams(Map.Entry v) { return addParams(List.of(v)); } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LauncherIconVerifier.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LauncherIconVerifier.java index 39e483f1feeb3..05510461c1657 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LauncherIconVerifier.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LauncherIconVerifier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -264,7 +264,7 @@ private void setIcon(Path iconPath, Path launcherPath) { static final WinIconVerifier instance = new WinIconVerifier(); - private final Class executableRebranderClass; + private final Class executableRebranderClass; private final Method lockResource; private final Method unlockResource; private final Method iconSwapWrapper; diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LinuxHelper.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LinuxHelper.java index ddbbee4aa6075..f97b695d98f37 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LinuxHelper.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LinuxHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -47,7 +47,7 @@ public final class LinuxHelper { private static String getReleaseSuffix(JPackageCommand cmd) { - String value = null; + final String value; final PackageType packageType = cmd.packageType(); switch (packageType) { case LINUX_DEB: @@ -60,6 +60,9 @@ private static String getReleaseSuffix(JPackageCommand cmd) { value = "-" + cmd.getArgumentValue("--linux-app-release", () -> "1"); break; + + default: + value = null; } return value; } @@ -95,7 +98,7 @@ static String getBundleName(JPackageCommand cmd) { cmd.verifyIsOfType(PackageType.LINUX); final PackageType packageType = cmd.packageType(); - String format = null; + final String format; switch (packageType) { case LINUX_DEB: format = "%s_%s%s_%s"; @@ -104,6 +107,9 @@ static String getBundleName(JPackageCommand cmd) { case LINUX_RPM: format = "%s-%s%s.%s"; break; + + default: + throw new UnsupportedOperationException(); } final String releaseSuffix = getReleaseSuffix(cmd); @@ -119,7 +125,7 @@ public static Stream getPackageFiles(JPackageCommand cmd) { final PackageType packageType = cmd.packageType(); final Path packageFile = cmd.outputBundle(); - Executor exec = null; + final Executor exec; switch (packageType) { case LINUX_DEB: exec = Executor.of("dpkg", "--contents").addArgument(packageFile); @@ -128,6 +134,9 @@ public static Stream getPackageFiles(JPackageCommand cmd) { case LINUX_RPM: exec = Executor.of("rpm", "-qpl").addArgument(packageFile); break; + + default: + throw new UnsupportedOperationException(); } Stream lines = exec.executeAndGetOutput().stream(); @@ -154,9 +163,10 @@ public static List getPrerequisitePackages(JPackageCommand cmd) { return Executor.of("rpm", "-qp", "-R") .addArgument(cmd.outputBundle()) .executeAndGetOutput(); + + default: + throw new UnsupportedOperationException(); } - // Unreachable - return null; } public static String getBundleProperty(JPackageCommand cmd, @@ -178,9 +188,10 @@ public static String getBundleProperty(JPackageCommand cmd, case LINUX_RPM: return getRpmBundleProperty(cmd.outputBundle(), propertyName.get( packageType)); + + default: + throw new UnsupportedOperationException(); } - // Unrechable - return null; } static PackageHandlers createDebPackageHandlers() { @@ -275,9 +286,9 @@ static long getInstalledPackageSizeKB(JPackageCommand cmd) { String size = getRpmBundleProperty(packageFile, "Size"); return (Long.parseLong(size) + 1023L) >> 10; // in KB rounded up + default: + throw new UnsupportedOperationException(); } - - return 0; } static String getDebBundleProperty(Path bundle, String fieldName) { @@ -425,7 +436,7 @@ private static void verifyDesktopFile(JPackageCommand cmd, Path desktopFile) return null; })); - final Set mandatoryKeys = new HashSet(Set.of("Name", "Comment", + final Set mandatoryKeys = new HashSet<>(Set.of("Name", "Comment", "Exec", "Icon", "Terminal", "Type", "Categories")); mandatoryKeys.removeAll(data.keySet()); TKit.assertTrue(mandatoryKeys.isEmpty(), String.format( @@ -626,10 +637,10 @@ private static Map> getScriptlets( case LINUX_RPM: return getRpmScriptlets(cmd, scriptletSet); - } - // Unreachable - return null; + default: + throw new UnsupportedOperationException(); + } } private static Map> getDebScriptlets( @@ -703,7 +714,7 @@ public static String getDefaultPackageArch(PackageType type) { String arch = archs.get(type); if (arch == null) { - Executor exec = null; + final Executor exec; switch (type) { case LINUX_DEB: exec = Executor.of("dpkg", "--print-architecture"); @@ -712,6 +723,9 @@ public static String getDefaultPackageArch(PackageType type) { case LINUX_RPM: exec = Executor.of("rpmbuild", "--eval=%{_target_cpu}"); break; + + default: + throw new UnsupportedOperationException(); } arch = exec.executeAndGetFirstLineOfOutput(); archs.put(type, arch); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java index 9cadd419ca135..2256963999aec 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -367,7 +367,7 @@ public List queryArrayValue(String keyName) { } NodeList childList = list.item(0).getChildNodes(); - List values = new ArrayList(childList.getLength()); + List values = new ArrayList<>(childList.getLength()); for (int i = 0; i < childList.getLength(); i++) { if (childList.item(i).getNodeName().equals("string")) { values.add(childList.item(i).getTextContent()); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MethodCall.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MethodCall.java index 51a8ade8a1d64..73d0a7fe495e4 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MethodCall.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MethodCall.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -40,7 +40,7 @@ import jdk.jpackage.internal.util.function.ThrowingConsumer; import jdk.jpackage.test.TestInstance.TestDesc; -class MethodCall implements ThrowingConsumer { +class MethodCall implements ThrowingConsumer { MethodCall(Object[] instanceCtorArgs, Method method, Object ... args) { Objects.requireNonNull(instanceCtorArgs); @@ -90,7 +90,7 @@ void checkRequiredConstructor() throws NoSuchMethodException { } } - private static Constructor findMatchingConstructor(Class type, Object... ctorArgs) + private static Constructor findMatchingConstructor(Class type, Object... ctorArgs) throws NoSuchMethodException { var ctors = filterMatchingExecutablesForParameterValues(Stream.of( @@ -114,6 +114,7 @@ public void accept(Object thiz) throws Throwable { private static Object[] mapVarArgs(Executable executable, final Object ... args) { if (executable.isVarArgs()) { var paramTypes = executable.getParameterTypes(); + @SuppressWarnings("rawtypes") Class varArgParamType = paramTypes[paramTypes.length - 1]; Object[] newArgs; @@ -124,6 +125,7 @@ private static Object[] mapVarArgs(Executable executable, final Object ... args) newArgs = Arrays.copyOf(args, args.length + 1, Object[].class); newArgs[newArgs.length - 1] = Array.newInstance(varArgParamType.componentType(), 0); } else { + @SuppressWarnings("unchecked") var varArgs = Arrays.copyOfRange(args, paramTypes.length - 1, args.length, varArgParamType); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java index fd6d5e2da6bc7..f89bd0a60c82c 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -446,6 +446,7 @@ public void accept(Action action) throws Throwable { case UNINSTALL: skip = (action == Action.VERIFY_UNINSTALL); break; + default: // NOP } } @@ -616,6 +617,8 @@ public void accept(Action action, JPackageCommand cmd) { } } break; + + default: // NOP } } @@ -702,6 +705,10 @@ private void verifyRootCountInUnpackedPackage(JPackageCommand cmd, roots.add(Path.of("/usr")); } } + + default -> { + throw new UnsupportedOperationException(); + } } } expectedRootCount = roots.size(); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageType.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageType.java index 8aa7d005adbd3..4d85f82df9b17 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageType.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -97,7 +97,7 @@ static PackageType fromSuffix(String packageFilename) { private static boolean isBundlerSupportedImpl(String bundlerClass) { try { - Class clazz = Class.forName(bundlerClass); + Class clazz = Class.forName(bundlerClass); Method supported = clazz.getMethod("supported", boolean.class); return ((Boolean) supported.invoke( clazz.getConstructor().newInstance(), true)); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java index b58595645682c..d3473952cf8d0 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -250,11 +250,6 @@ public static void traceFileContents(Path path, String label) throws IOException trace("Done"); } - public static void createPropertiesFile(Path propsFilename, - Map.Entry... props) { - createPropertiesFile(propsFilename, List.of(props)); - } - public static void createPropertiesFile(Path propsFilename, Map props) { createPropertiesFile(propsFilename, props.entrySet()); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java index 23fd5dd52a508..195d1ea3936b9 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -23,6 +23,7 @@ package jdk.jpackage.test; +import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -49,7 +50,7 @@ final class TestBuilder implements AutoCloseable { @Override - public void close() throws Exception { + public void close() { flushTestGroup(); } @@ -168,8 +169,8 @@ private void flushTestGroup() { } private void createTestInstance(MethodCall testBody) { - final List curBeforeActions; - final List curAfterActions; + final List> curBeforeActions; + final List> curAfterActions; Method testMethod = testBody.getMethod(); if (Stream.of(BeforeEach.class, AfterEach.class).anyMatch( @@ -203,7 +204,7 @@ private void clear() { testGroup = null; } - private static Class probeClass(String name) { + private static Class probeClass(String name) { try { return Class.forName(name); } catch (ClassNotFoundException ex) { @@ -211,7 +212,7 @@ private static Class probeClass(String name) { } } - private static Stream selectFrameMethods(Class type, Class annotationType) { + private static Stream selectFrameMethods(Class type, Class annotationType) { return Stream.of(type.getMethods()) .filter(m -> m.getParameterCount() == 0) .filter(m -> !m.isAnnotationPresent(Test.class)) @@ -223,7 +224,7 @@ private Stream cmdLineArgValueToMethodNames(String v) { List result = new ArrayList<>(); String defaultClassName = null; for (String token : v.split(",")) { - Class testSet = probeClass(token); + Class testSet = probeClass(token); if (testSet != null) { if (testMethodSupplier.isTestClass(testSet)) { toConsumer(testMethodSupplier::verifyTestClass).accept(testSet); @@ -295,10 +296,10 @@ private Stream toMethodCalls(Method method) throws }); } - // Wraps Method.invike() into ThrowingRunnable.run() - private ThrowingConsumer wrap(Method method) { + // Wraps Method.invoke() into ThrowingRunnable.run() + private ThrowingConsumer wrap(Method method) { return (test) -> { - Class methodClass = method.getDeclaringClass(); + Class methodClass = method.getDeclaringClass(); String methodName = String.join(".", methodClass.getName(), method.getName()); TKit.log(String.format("[ CALL ] %s()", methodName)); @@ -335,6 +336,7 @@ public String getMessage() { return msg; } private String badCmdLineArg; + private static final long serialVersionUID = 1L; } static void trace(String msg) { @@ -347,8 +349,8 @@ static void trace(String msg) { private final Map> argProcessors; private final Consumer testConsumer; private List testGroup; - private List beforeActions; - private List afterActions; + private List> beforeActions; + private List> afterActions; private Set excludedTests; private Set includedTests; private String spaceSubstitute; diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java index 871ddc2427784..dd1e46eb09e4e 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -144,7 +144,7 @@ static TestDesc create(Method m, Object... args) { return desc; } - private Class clazz; + private Class clazz; private String functionName; private String functionArgs; private String instanceArgs; @@ -161,8 +161,8 @@ static TestDesc create(Method m, Object... args) { this.workDir = createWorkDirName(testDesc); } - TestInstance(MethodCall testBody, List beforeActions, - List afterActions, boolean dryRun) { + TestInstance(MethodCall testBody, List> beforeActions, + List> afterActions, boolean dryRun) { assertCount = 0; this.testConstructor = v -> ((MethodCall)v).newInstance(); this.testBody = testBody; @@ -255,7 +255,7 @@ public void run() throws Throwable { } } - private static Class enclosingMainMethodClass() { + private static Class enclosingMainMethodClass() { StackTraceElement st[] = Thread.currentThread().getStackTrace(); for (StackTraceElement ste : st) { if ("main".equals(ste.getMethodName())) { @@ -323,10 +323,10 @@ public String toString() { private Status status; private RuntimeException skippedTestException; private final TestDesc testDesc; - private final ThrowingFunction testConstructor; - private final ThrowingConsumer testBody; - private final List beforeActions; - private final List afterActions; + private final ThrowingFunction, Object> testConstructor; + private final ThrowingConsumer testBody; + private final List> beforeActions; + private final List> afterActions; private final boolean dryRun; private final Path workDir; diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestMethodSupplier.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestMethodSupplier.java index 0d701d0ec6f55..6ba4da0590ca3 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestMethodSupplier.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestMethodSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -63,7 +63,7 @@ final class TestMethodSupplier { record MethodQuery(String className, String methodName) { List lookup() throws ClassNotFoundException { - final Class methodClass = Class.forName(className); + final Class methodClass = Class.forName(className); // Get the list of all public methods as need to deal with overloads. return Stream.of(methodClass.getMethods()).filter(method -> { @@ -269,7 +269,7 @@ private List createArgsForAnnotation(Executable exec, final Method supplierMethod; try { final var parameterSupplierCandidates = findNullaryLikeMethods(methodQuery); - final Function classForName = toFunction(Class::forName); + final Function> classForName = toFunction(Class::forName); final var supplierMethodClass = classForName.apply(methodQuery.className()); if (parameterSupplierCandidates.isEmpty()) { throw new RuntimeException(String.format( @@ -348,11 +348,11 @@ private static boolean canRunOnTheOperatingSystem(OperatingSystem value, private static Parameter[] getMethodParameters(Method method) { if (method.isAnnotationPresent(ParameterGroup.class)) { - return ((ParameterGroup) method.getAnnotation(ParameterGroup.class)).value(); + return method.getAnnotation(ParameterGroup.class).value(); } if (method.isAnnotationPresent(Parameter.class)) { - return new Parameter[]{(Parameter) method.getAnnotation(Parameter.class)}; + return new Parameter[]{method.getAnnotation(Parameter.class)}; } return new Parameter[0]; @@ -360,12 +360,11 @@ private static Parameter[] getMethodParameters(Method method) { private static ParameterSupplier[] getMethodParameterSuppliers(Method method) { if (method.isAnnotationPresent(ParameterSupplierGroup.class)) { - return ((ParameterSupplierGroup) method.getAnnotation(ParameterSupplierGroup.class)).value(); + return (method.getAnnotation(ParameterSupplierGroup.class)).value(); } if (method.isAnnotationPresent(ParameterSupplier.class)) { - return new ParameterSupplier[]{(ParameterSupplier) method.getAnnotation( - ParameterSupplier.class)}; + return new ParameterSupplier[]{method.getAnnotation(ParameterSupplier.class)}; } return new ParameterSupplier[0]; @@ -378,18 +377,20 @@ private static Stream filterParameterSuppliers(Class type) { .sorted(Comparator.comparing(Method::getName)); } + @SuppressWarnings("unchecked") private static Stream createArgs(Method ... parameterSuppliers) throws IllegalAccessException, InvocationTargetException { List args = new ArrayList<>(); for (var parameterSupplier : parameterSuppliers) { - args.addAll((Collection) parameterSupplier.invoke(null)); + args.addAll((Collection) parameterSupplier.invoke(null)); } return args.stream(); } - private static Object fromString(String value, Class toType) { + @SuppressWarnings({"unchecked", "rawtypes"}) + private static Object fromString(String value, Class toType) { if (toType.isEnum()) { - return Enum.valueOf(toType, value); + return Enum.valueOf((Class)toType, value); } Function converter = FROM_STRING.get(toType); if (converter == null) { @@ -410,6 +411,7 @@ static class InvalidAnnotationException extends Exception { InvalidAnnotationException(String msg) { super(msg); } + private static final long serialVersionUID = 1L; } private static class Verifier { @@ -476,10 +478,10 @@ private enum TypeStatus { private static final Object[] DEFAULT_CTOR_ARGS = new Object[0]; - private static final Map> FROM_STRING; + private static final Map, Function> FROM_STRING; static { - Map> primitives = Map.of( + Map, Function> primitives = Map.of( boolean.class, Boolean::valueOf, byte.class, Byte::valueOf, short.class, Short::valueOf, @@ -488,7 +490,7 @@ private enum TypeStatus { float.class, Float::valueOf, double.class, Double::valueOf); - Map> boxed = Map.of( + Map, Function> boxed = Map.of( Boolean.class, Boolean::valueOf, Byte.class, Byte::valueOf, Short.class, Short::valueOf, @@ -497,11 +499,11 @@ private enum TypeStatus { Float.class, Float::valueOf, Double.class, Double::valueOf); - Map> other = Map.of( + Map, Function> other = Map.of( String.class, String::valueOf, Path.class, Path::of); - Map> combined = new HashMap<>(primitives); + Map, Function> combined = new HashMap<>(primitives); combined.putAll(other); combined.putAll(boxed); diff --git a/test/jdk/tools/jpackage/linux/LinuxResourceTest.java b/test/jdk/tools/jpackage/linux/LinuxResourceTest.java index 5a460b39ed7fa..1dc8dee3c9768 100644 --- a/test/jdk/tools/jpackage/linux/LinuxResourceTest.java +++ b/test/jdk/tools/jpackage/linux/LinuxResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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,7 +36,7 @@ * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* * @requires (os.family == "linux") - * @compile LinuxResourceTest.java + * @compile -Xlint:all -Werror LinuxResourceTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=LinuxResourceTest */ diff --git a/test/jdk/tools/jpackage/linux/LinuxWeirdOutputDirTest.java b/test/jdk/tools/jpackage/linux/LinuxWeirdOutputDirTest.java index a30c172461103..b59205783470a 100644 --- a/test/jdk/tools/jpackage/linux/LinuxWeirdOutputDirTest.java +++ b/test/jdk/tools/jpackage/linux/LinuxWeirdOutputDirTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -32,7 +32,7 @@ * @bug 8268974 * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile LinuxWeirdOutputDirTest.java + * @compile -Xlint:all -Werror LinuxWeirdOutputDirTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=LinuxWeirdOutputDirTest */ diff --git a/test/jdk/tools/jpackage/linux/PackageDepsTest.java b/test/jdk/tools/jpackage/linux/PackageDepsTest.java index 1a69582fc841e..6e2a8af1e58db 100644 --- a/test/jdk/tools/jpackage/linux/PackageDepsTest.java +++ b/test/jdk/tools/jpackage/linux/PackageDepsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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,7 +50,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (os.family == "linux") - * @compile PackageDepsTest.java + * @compile -Xlint:all -Werror PackageDepsTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=PackageDepsTest */ diff --git a/test/jdk/tools/jpackage/linux/ServiceAndDesktopTest.java b/test/jdk/tools/jpackage/linux/ServiceAndDesktopTest.java index 581190ad341f4..e7f1463f7a35c 100644 --- a/test/jdk/tools/jpackage/linux/ServiceAndDesktopTest.java +++ b/test/jdk/tools/jpackage/linux/ServiceAndDesktopTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -22,7 +22,6 @@ */ import java.nio.file.Path; -import jdk.jpackage.test.AdditionalLauncher; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.LauncherAsServiceVerifier; @@ -44,7 +43,7 @@ * @requires jpackage.test.SQETest == null * @build jdk.jpackage.test.* * @requires (os.family == "linux") - * @compile ServiceAndDesktopTest.java + * @compile -Xlint:all -Werror ServiceAndDesktopTest.java * @run main/othervm/timeout=720 jdk.jpackage.test.Main * --jpt-run=ServiceAndDesktopTest */ diff --git a/test/jdk/tools/jpackage/linux/ShortcutHintTest.java b/test/jdk/tools/jpackage/linux/ShortcutHintTest.java index 01e890751388a..fc34d024a987f 100644 --- a/test/jdk/tools/jpackage/linux/ShortcutHintTest.java +++ b/test/jdk/tools/jpackage/linux/ShortcutHintTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -58,7 +58,7 @@ * @requires jpackage.test.SQETest == null * @build jdk.jpackage.test.* * @requires (os.family == "linux") - * @compile ShortcutHintTest.java + * @compile -Xlint:all -Werror ShortcutHintTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ShortcutHintTest */ @@ -71,7 +71,7 @@ * @build jdk.jpackage.test.* * @requires (os.family == "linux") * @requires jpackage.test.SQETest != null - * @compile ShortcutHintTest.java + * @compile -Xlint:all -Werror ShortcutHintTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ShortcutHintTest.testBasic */ diff --git a/test/jdk/tools/jpackage/linux/UpgradeTest.java b/test/jdk/tools/jpackage/linux/UpgradeTest.java index 4bf13476eb5a3..fb399cec12bdb 100644 --- a/test/jdk/tools/jpackage/linux/UpgradeTest.java +++ b/test/jdk/tools/jpackage/linux/UpgradeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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,7 +36,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (os.family == "linux") - * @compile UpgradeTest.java + * @compile -Xlint:all -Werror UpgradeTest.java * @run main/othervm/timeout=360 jdk.jpackage.test.Main * --jpt-run=UpgradeTest */ diff --git a/test/jdk/tools/jpackage/linux/UsrTreeTest.java b/test/jdk/tools/jpackage/linux/UsrTreeTest.java index 819ea8f245a12..e33364c605d9d 100644 --- a/test/jdk/tools/jpackage/linux/UsrTreeTest.java +++ b/test/jdk/tools/jpackage/linux/UsrTreeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -45,7 +45,7 @@ * @requires jpackage.test.SQETest == null * @requires (os.family == "linux") * @build jdk.jpackage.test.* - * @compile UsrTreeTest.java + * @compile -Xlint:all -Werror UsrTreeTest.java * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=UsrTreeTest */ diff --git a/test/jdk/tools/jpackage/macosx/ArgumentsFilteringTest.java b/test/jdk/tools/jpackage/macosx/ArgumentsFilteringTest.java index 9b57cd7fbe56e..1a42a30c00e9e 100644 --- a/test/jdk/tools/jpackage/macosx/ArgumentsFilteringTest.java +++ b/test/jdk/tools/jpackage/macosx/ArgumentsFilteringTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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,7 +38,7 @@ * @summary jpackage with -psn * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile ArgumentsFilteringTest.java + * @compile -Xlint:all -Werror ArgumentsFilteringTest.java * @requires (os.family == "mac") * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ArgumentsFilteringTest diff --git a/test/jdk/tools/jpackage/macosx/DmgContentTest.java b/test/jdk/tools/jpackage/macosx/DmgContentTest.java index fefbe229ec5ae..c670d111e20c8 100644 --- a/test/jdk/tools/jpackage/macosx/DmgContentTest.java +++ b/test/jdk/tools/jpackage/macosx/DmgContentTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -57,7 +57,7 @@ public class DmgContentTest { "non-existant").toString(); @Parameters - public static Collection input() { + public static Collection input() { List data = new ArrayList<>(); data.addAll(List.of(new Object[][] { {"0", PackageType.MAC_DMG, new String[] {TEST_JAVA, TEST_DUKE}}, diff --git a/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java b/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java index 69e1cd6c42a9e..5c4a7ac0e8e76 100644 --- a/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java +++ b/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -45,7 +45,7 @@ * @summary jpackage test to validate "hostArchitectures" attribute * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile HostArchPkgTest.java + * @compile -Xlint:all -Werror HostArchPkgTest.java * @requires (os.family == "mac") * @key jpackagePlatformPackage * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main diff --git a/test/jdk/tools/jpackage/macosx/MacPropertiesTest.java b/test/jdk/tools/jpackage/macosx/MacPropertiesTest.java index 5482a3ea508ce..67a5cf6b609ef 100644 --- a/test/jdk/tools/jpackage/macosx/MacPropertiesTest.java +++ b/test/jdk/tools/jpackage/macosx/MacPropertiesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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,7 +38,7 @@ * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* * @requires (os.family == "mac") - * @compile MacPropertiesTest.java + * @compile -Xlint:all -Werror MacPropertiesTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=MacPropertiesTest */ diff --git a/test/jdk/tools/jpackage/macosx/NameWithSpaceTest.java b/test/jdk/tools/jpackage/macosx/NameWithSpaceTest.java index ea95ad964f381..06da5a83d06d9 100644 --- a/test/jdk/tools/jpackage/macosx/NameWithSpaceTest.java +++ b/test/jdk/tools/jpackage/macosx/NameWithSpaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -40,7 +40,7 @@ * @summary jpackage test with name containing spaces * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile NameWithSpaceTest.java + * @compile -Xlint:all -Werror NameWithSpaceTest.java * @requires (os.family == "mac") * @key jpackagePlatformPackage * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main diff --git a/test/jdk/tools/jpackage/macosx/SigningOptionsTest.java b/test/jdk/tools/jpackage/macosx/SigningOptionsTest.java index c5df2c1b31bda..88595c566dfb3 100644 --- a/test/jdk/tools/jpackage/macosx/SigningOptionsTest.java +++ b/test/jdk/tools/jpackage/macosx/SigningOptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -69,7 +69,7 @@ public final class SigningOptionsTest { "apps/dukeplug.png").toString(); @Parameters - public static Collection input() { + public static Collection input() { return List.of(new Object[][]{ // --mac-signing-key-user-name and --mac-app-image-sign-identity {"Hello", diff --git a/test/jdk/tools/jpackage/macosx/base/SigningBase.java b/test/jdk/tools/jpackage/macosx/base/SigningBase.java index 15031bc42be57..254aa306b522c 100644 --- a/test/jdk/tools/jpackage/macosx/base/SigningBase.java +++ b/test/jdk/tools/jpackage/macosx/base/SigningBase.java @@ -98,6 +98,7 @@ private static void checkString(List result, String lookupString) { (line, what) -> line.trim().contains(what)).apply(result.stream()); } + @SuppressWarnings("fallthrough") private static List codesignResult(Path target, CodesignCheckType type) { int exitCode = 0; Executor executor = new Executor().setExecutable("/usr/bin/codesign"); diff --git a/test/jdk/tools/jpackage/macosx/base/SigningCheck.java b/test/jdk/tools/jpackage/macosx/base/SigningCheck.java index 4ba2763804f06..3db101f38069a 100644 --- a/test/jdk/tools/jpackage/macosx/base/SigningCheck.java +++ b/test/jdk/tools/jpackage/macosx/base/SigningCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -22,10 +22,6 @@ */ import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.io.IOException; import jdk.jpackage.test.TKit; import jdk.jpackage.test.Executor; diff --git a/test/jdk/tools/jpackage/share/AddLShortcutTest.java b/test/jdk/tools/jpackage/share/AddLShortcutTest.java index 5b55d906cf163..6430a55d784af 100644 --- a/test/jdk/tools/jpackage/share/AddLShortcutTest.java +++ b/test/jdk/tools/jpackage/share/AddLShortcutTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -44,7 +44,7 @@ * @key jpackagePlatformPackage * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile AddLShortcutTest.java + * @compile -Xlint:all -Werror AddLShortcutTest.java * @run main/othervm/timeout=540 -Xmx512m * jdk.jpackage.test.Main * --jpt-run=AddLShortcutTest diff --git a/test/jdk/tools/jpackage/share/AddLauncherTest.java b/test/jdk/tools/jpackage/share/AddLauncherTest.java index af0efc4fb86e3..5c21be712581a 100644 --- a/test/jdk/tools/jpackage/share/AddLauncherTest.java +++ b/test/jdk/tools/jpackage/share/AddLauncherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -49,7 +49,7 @@ * @requires (jpackage.test.SQETest != null) * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile AddLauncherTest.java + * @compile -Xlint:all -Werror AddLauncherTest.java * @run main/othervm/timeout=360 -Xmx512m * jdk.jpackage.test.Main * --jpt-run=AddLauncherTest.test @@ -62,7 +62,7 @@ * @requires (jpackage.test.SQETest == null) * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile AddLauncherTest.java + * @compile -Xlint:all -Werror AddLauncherTest.java * @run main/othervm/timeout=540 -Xmx512m * jdk.jpackage.test.Main * --jpt-run=AddLauncherTest diff --git a/test/jdk/tools/jpackage/share/AppContentTest.java b/test/jdk/tools/jpackage/share/AppContentTest.java index d33960092ee88..c14cd50cc1193 100644 --- a/test/jdk/tools/jpackage/share/AppContentTest.java +++ b/test/jdk/tools/jpackage/share/AppContentTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -70,7 +70,7 @@ public class AppContentTest { private final List testPathArgs; @Parameters - public static Collection data() { + public static Collection data() { return List.of(new String[][]{ {TEST_JAVA, TEST_DUKE}, // include two files in two options {TEST_JAVA, TEST_BAD}, // try to include non-existant content diff --git a/test/jdk/tools/jpackage/share/AppImagePackageTest.java b/test/jdk/tools/jpackage/share/AppImagePackageTest.java index 7185e63145f01..030cca50f1445 100644 --- a/test/jdk/tools/jpackage/share/AppImagePackageTest.java +++ b/test/jdk/tools/jpackage/share/AppImagePackageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -46,7 +46,7 @@ * @library /test/jdk/tools/jpackage/helpers * @requires (jpackage.test.SQETest == null) * @build jdk.jpackage.test.* - * @compile AppImagePackageTest.java + * @compile -Xlint:all -Werror AppImagePackageTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=AppImagePackageTest */ diff --git a/test/jdk/tools/jpackage/share/AppVersionTest.java b/test/jdk/tools/jpackage/share/AppVersionTest.java index 3fdddf56e2eaa..e81b1eae9cfa9 100644 --- a/test/jdk/tools/jpackage/share/AppVersionTest.java +++ b/test/jdk/tools/jpackage/share/AppVersionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -39,7 +39,7 @@ * @summary jpackage application version testing * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile AppVersionTest.java + * @compile -Xlint:all -Werror AppVersionTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=AppVersionTest */ @@ -47,7 +47,7 @@ public final class AppVersionTest { @Parameters - public static Collection input() { + public static Collection input() { List data = new ArrayList<>(); data.addAll(List.of(new Object[][]{ diff --git a/test/jdk/tools/jpackage/share/ArgumentsTest.java b/test/jdk/tools/jpackage/share/ArgumentsTest.java index 3be6c36a25c89..e3e0724a3e24f 100644 --- a/test/jdk/tools/jpackage/share/ArgumentsTest.java +++ b/test/jdk/tools/jpackage/share/ArgumentsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -48,7 +48,7 @@ * @summary jpackage create image with --arguments test * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile ArgumentsTest.java + * @compile -Xlint:all -Werror ArgumentsTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ArgumentsTest */ diff --git a/test/jdk/tools/jpackage/share/BasicTest.java b/test/jdk/tools/jpackage/share/BasicTest.java index d479f4a35d084..94e0a335d18ae 100644 --- a/test/jdk/tools/jpackage/share/BasicTest.java +++ b/test/jdk/tools/jpackage/share/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -53,14 +53,14 @@ * @summary jpackage basic testing * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile BasicTest.java + * @compile -Xlint:all -Werror BasicTest.java * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=BasicTest */ public final class BasicTest { - public static Collection addModulesParams() { + public static Collection addModulesParams() { List params = new ArrayList<>(); params.add(new Object[][] { new String[] { "--add-modules", "ALL-DEFAULT" } }); params.add(new Object[][] { new String[] { "--add-modules", "java.desktop" } }); @@ -108,7 +108,6 @@ public void testJpackageProps() { .ignoreFakeRuntime(); cmd.executeAndAssertImageCreated(); - Path launcherPath = cmd.appLauncherPath(); List output = HelloApp.executeLauncher(cmd).getOutput(); diff --git a/test/jdk/tools/jpackage/share/CookedRuntimeTest.java b/test/jdk/tools/jpackage/share/CookedRuntimeTest.java index e8bd034bfb4b1..28fba111c8faa 100644 --- a/test/jdk/tools/jpackage/share/CookedRuntimeTest.java +++ b/test/jdk/tools/jpackage/share/CookedRuntimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -43,7 +43,7 @@ * @summary test '--runtime-image' option of jpackage * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile CookedRuntimeTest.java + * @compile -Xlint:all -Werror CookedRuntimeTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=CookedRuntimeTest */ @@ -112,7 +112,7 @@ public void test() throws IOException { } @Parameters - public static Collection data() { + public static Collection data() { final List javaAppDescs = List.of("Hello", "com.foo/com.foo.main.Aloha"); diff --git a/test/jdk/tools/jpackage/share/DotInNameTest.java b/test/jdk/tools/jpackage/share/DotInNameTest.java index 2617db26183e7..8fb2641a6f3c7 100644 --- a/test/jdk/tools/jpackage/share/DotInNameTest.java +++ b/test/jdk/tools/jpackage/share/DotInNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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,8 +24,6 @@ import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.HelloApp; -import jdk.jpackage.test.TKit; -import jdk.jpackage.test.Annotations.Parameters; import jdk.jpackage.test.Annotations.Test; @@ -34,7 +32,7 @@ * @summary jpackage create image with --java-options test * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile DotInNameTest.java + * @compile -Xlint:all -Werror DotInNameTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=DotInNameTest * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault diff --git a/test/jdk/tools/jpackage/share/ErrorTest.java b/test/jdk/tools/jpackage/share/ErrorTest.java index c14da0da0f076..f28fe0a41523f 100644 --- a/test/jdk/tools/jpackage/share/ErrorTest.java +++ b/test/jdk/tools/jpackage/share/ErrorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -41,7 +41,7 @@ * @summary Test jpackage output for erroneous input * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile ErrorTest.java + * @compile -Xlint:all -Werror ErrorTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ErrorTest * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault @@ -52,7 +52,7 @@ * @summary Test jpackage output for erroneous input * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile ErrorTest.java + * @compile -Xlint:all -Werror ErrorTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ErrorTest * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault @@ -60,7 +60,7 @@ public final class ErrorTest { - public static Collection input() { + public static Collection input() { return List.of(new Object[][]{ // non-existent arg {"Hello", diff --git a/test/jdk/tools/jpackage/share/FileAssociationsTest.java b/test/jdk/tools/jpackage/share/FileAssociationsTest.java index a06ea82bcbae3..08578ab802744 100644 --- a/test/jdk/tools/jpackage/share/FileAssociationsTest.java +++ b/test/jdk/tools/jpackage/share/FileAssociationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -23,13 +23,13 @@ import java.nio.file.Path; import java.util.Map; -import java.util.List; -import jdk.jpackage.test.TKit; + +import jdk.jpackage.test.Annotations.Parameter; +import jdk.jpackage.test.Annotations.Test; +import jdk.jpackage.test.FileAssociations; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; -import jdk.jpackage.test.FileAssociations; -import jdk.jpackage.test.Annotations.Test; -import jdk.jpackage.test.Annotations.Parameter; +import jdk.jpackage.test.TKit; /** * Test --file-associations parameter. Output of the test should be @@ -61,7 +61,7 @@ * @key jpackagePlatformPackage * @requires jpackage.test.SQETest == null * @build jdk.jpackage.test.* - * @compile FileAssociationsTest.java + * @compile -Xlint:all -Werror FileAssociationsTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=FileAssociationsTest */ @@ -73,7 +73,7 @@ * @key jpackagePlatformPackage * @requires jpackage.test.SQETest != null * @build jdk.jpackage.test.* - * @compile FileAssociationsTest.java + * @compile -Xlint:all -Werror FileAssociationsTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=FileAssociationsTest.test */ diff --git a/test/jdk/tools/jpackage/share/IconTest.java b/test/jdk/tools/jpackage/share/IconTest.java index d5edbc9324566..f5498500c0bc3 100644 --- a/test/jdk/tools/jpackage/share/IconTest.java +++ b/test/jdk/tools/jpackage/share/IconTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -51,7 +51,7 @@ * @summary jpackage create image and package with custom icons for the main and additional launcher * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile IconTest.java + * @compile -Xlint:all -Werror IconTest.java * @run main/othervm/timeout=540 -Xmx512m * jdk.jpackage.test.Main * --jpt-run=IconTest @@ -113,7 +113,7 @@ public IconTest(BundleType bundleType, IconType mainLauncherIconType) { } @Parameters - public static Collection data() { + public static Collection data() { List data = new ArrayList<>(); var withLinuxShortcut = Set.of(IconType.DefaultIcon, IconType.NoIcon); diff --git a/test/jdk/tools/jpackage/share/InOutPathTest.java b/test/jdk/tools/jpackage/share/InOutPathTest.java index 46da5e9939b00..2d9fa1671dec0 100644 --- a/test/jdk/tools/jpackage/share/InOutPathTest.java +++ b/test/jdk/tools/jpackage/share/InOutPathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -49,14 +49,14 @@ * @summary Test jpackage command line with overlapping input and output paths * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile InOutPathTest.java + * @compile -Xlint:all -Werror InOutPathTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=InOutPathTest */ public final class InOutPathTest { @Parameters - public static Collection input() { + public static Collection input() { List data = new ArrayList<>(); for (var packageTypeAlias : PackageTypeAlias.values()) { diff --git a/test/jdk/tools/jpackage/share/InstallDirTest.java b/test/jdk/tools/jpackage/share/InstallDirTest.java index 23539589bcc07..672a435d22054 100644 --- a/test/jdk/tools/jpackage/share/InstallDirTest.java +++ b/test/jdk/tools/jpackage/share/InstallDirTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -56,7 +56,7 @@ * @library /test/jdk/tools/jpackage/helpers * @key jpackagePlatformPackage * @build jdk.jpackage.test.* - * @compile InstallDirTest.java + * @compile -Xlint:all -Werror InstallDirTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=InstallDirTest.testCommon */ @@ -67,7 +67,7 @@ * @library /test/jdk/tools/jpackage/helpers * @key jpackagePlatformPackage * @build jdk.jpackage.test.* - * @compile InstallDirTest.java + * @compile -Xlint:all -Werror InstallDirTest.java * @requires (os.family == "linux") * @requires (jpackage.test.SQETest == null) * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main diff --git a/test/jdk/tools/jpackage/share/JLinkOptionsTest.java b/test/jdk/tools/jpackage/share/JLinkOptionsTest.java index 1bffc00bcd1ef..f64c77d9f356d 100644 --- a/test/jdk/tools/jpackage/share/JLinkOptionsTest.java +++ b/test/jdk/tools/jpackage/share/JLinkOptionsTest.java @@ -40,14 +40,14 @@ * @summary jpackage application version testing * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile JLinkOptionsTest.java + * @compile -Xlint:all -Werror JLinkOptionsTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=JLinkOptionsTest */ public final class JLinkOptionsTest { - public static Collection input() { + public static Collection input() { return List.of(new Object[][]{ // default but with strip-native-commands removed {"Hello", new String[]{ diff --git a/test/jdk/tools/jpackage/share/JavaOptionsEqualsTest.java b/test/jdk/tools/jpackage/share/JavaOptionsEqualsTest.java index b1f69c6395f14..a4c2a26944a5a 100644 --- a/test/jdk/tools/jpackage/share/JavaOptionsEqualsTest.java +++ b/test/jdk/tools/jpackage/share/JavaOptionsEqualsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.HelloApp; -import jdk.jpackage.test.Executor; import jdk.jpackage.test.TKit; /* @@ -36,7 +35,7 @@ * @summary jpackage create image with --java-options test * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile JavaOptionsEqualsTest.java + * @compile -Xlint:all -Werror JavaOptionsEqualsTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=JavaOptionsEqualsTest * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault @@ -47,7 +46,7 @@ * @summary jpackage create image with --java-options test * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile JavaOptionsEqualsTest.java + * @compile -Xlint:all -Werror JavaOptionsEqualsTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=JavaOptionsEqualsTest * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault @@ -67,7 +66,7 @@ public class JavaOptionsEqualsTest { private final JPackageCommand cmd; @Parameters - public static Collection input() { + public static Collection input() { return List.of(new Object[][]{ {"Hello", new String[]{"--java-options", OPTION1, "--java-options", OPTION2 }, diff --git a/test/jdk/tools/jpackage/share/JavaOptionsTest.java b/test/jdk/tools/jpackage/share/JavaOptionsTest.java index befc90accea13..e15dc02eac6e6 100644 --- a/test/jdk/tools/jpackage/share/JavaOptionsTest.java +++ b/test/jdk/tools/jpackage/share/JavaOptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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,7 +36,7 @@ * @summary jpackage create image with --java-options test * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile JavaOptionsTest.java + * @compile -Xlint:all -Werror JavaOptionsTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=JavaOptionsTest * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault @@ -58,7 +58,7 @@ public class JavaOptionsTest { private final String[] expected; @Parameters - public static Collection input() { + public static Collection input() { List result = new ArrayList<>(); for (var app : List.of("Hello", "com.other/com.other.Hello")) { result.add(new Object[]{app, new String[]{"--java-options", ARG1}, diff --git a/test/jdk/tools/jpackage/share/LicenseTest.java b/test/jdk/tools/jpackage/share/LicenseTest.java index 66cda39eec288..c9e3c8508aa61 100644 --- a/test/jdk/tools/jpackage/share/LicenseTest.java +++ b/test/jdk/tools/jpackage/share/LicenseTest.java @@ -68,7 +68,7 @@ * @library /test/jdk/tools/jpackage/helpers * @key jpackagePlatformPackage * @build jdk.jpackage.test.* - * @compile LicenseTest.java + * @compile -Xlint:all -Werror LicenseTest.java * @requires (jpackage.test.SQETest != null) * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=LicenseTest.testCommon @@ -80,7 +80,7 @@ * @library /test/jdk/tools/jpackage/helpers * @key jpackagePlatformPackage * @build jdk.jpackage.test.* - * @compile LicenseTest.java + * @compile -Xlint:all -Werror LicenseTest.java * @requires (jpackage.test.SQETest == null) * @run main/othervm/timeout=1440 -Xmx512m jdk.jpackage.test.Main * --jpt-run=LicenseTest @@ -271,7 +271,7 @@ private static class CustomDebianCopyrightTest { } private List licenseFileText(String copyright, String licenseText) { - List lines = new ArrayList(List.of( + List lines = new ArrayList<>(List.of( String.format("Copyright=%s", copyright), "Foo", "Bar", diff --git a/test/jdk/tools/jpackage/share/MainClassTest.java b/test/jdk/tools/jpackage/share/MainClassTest.java index a031bbc278802..7ac72c2c87b41 100644 --- a/test/jdk/tools/jpackage/share/MainClassTest.java +++ b/test/jdk/tools/jpackage/share/MainClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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,27 +24,28 @@ import java.io.IOException; import java.nio.file.Files; -import java.util.Collection; +import java.nio.file.Path; import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import java.util.Objects; import java.util.Set; +import java.util.function.Predicate; +import java.util.jar.JarEntry; import java.util.jar.JarFile; -import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; -import java.nio.file.Path; -import java.util.function.Predicate; -import java.util.jar.JarEntry; -import jdk.jpackage.test.JavaAppDesc; -import jdk.jpackage.test.JPackageCommand; -import jdk.jpackage.test.TKit; -import jdk.jpackage.test.Executor; -import jdk.jpackage.test.HelloApp; -import jdk.jpackage.test.JavaTool; + +import jdk.jpackage.internal.util.function.ThrowingConsumer; import jdk.jpackage.test.Annotations.Parameters; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.CfgFile; -import jdk.jpackage.internal.util.function.ThrowingConsumer; +import jdk.jpackage.test.Executor; +import jdk.jpackage.test.HelloApp; +import jdk.jpackage.test.JPackageCommand; +import jdk.jpackage.test.JavaAppDesc; +import jdk.jpackage.test.JavaTool; +import jdk.jpackage.test.TKit; @@ -53,7 +54,7 @@ * @summary test different settings of main class name for jpackage * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile MainClassTest.java + * @compile -Xlint:all -Werror MainClassTest.java * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=MainClassTest */ @@ -124,7 +125,7 @@ public String toString() { } private final String label; - }; + } private JavaAppDesc appDesc; private boolean withJLink; @@ -166,11 +167,16 @@ public MainClassTest(Script script) { } else { cmd.setArgumentValue("--main-class", nonExistingMainClass); } + break; + + case SetRight: + // NOP + break; } } @Parameters - public static Collection scripts() { + public static Collection scripts() { final var withMainClass = Set.of(Script.MainClassType.SetWrong, Script.MainClassType.SetRight); diff --git a/test/jdk/tools/jpackage/share/ModulePathTest.java b/test/jdk/tools/jpackage/share/ModulePathTest.java index 7d1e86f8ae2c7..9fd07a95c230a 100644 --- a/test/jdk/tools/jpackage/share/ModulePathTest.java +++ b/test/jdk/tools/jpackage/share/ModulePathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -45,7 +45,7 @@ * @summary jpackage with --module-path testing * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile ModulePathTest.java + * @compile -Xlint:all -Werror ModulePathTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ModulePathTest */ @@ -53,7 +53,7 @@ public final class ModulePathTest { @Parameters - public static Collection data() { + public static Collection data() { return List.of(new String[][]{ {GOOD_PATH, EMPTY_DIR, NON_EXISTING_DIR}, {EMPTY_DIR, NON_EXISTING_DIR, GOOD_PATH}, @@ -80,7 +80,7 @@ public void test(String javaAppDesc) throws IOException { Path goodModulePath = TKit.createTempDirectory("modules"); - Path appBundle = HelloApp.createBundle(appDesc, goodModulePath); + HelloApp.createBundle(appDesc, goodModulePath); JPackageCommand cmd = new JPackageCommand() .setArgumentValue("--dest", TKit.workDir().resolve("output")) diff --git a/test/jdk/tools/jpackage/share/ModulePathTest2.java b/test/jdk/tools/jpackage/share/ModulePathTest2.java index 34144907bdbee..b2cc674e7e9fe 100644 --- a/test/jdk/tools/jpackage/share/ModulePathTest2.java +++ b/test/jdk/tools/jpackage/share/ModulePathTest2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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,7 @@ * @summary jpackage with --module-path testing * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile ModulePathTest2.java + * @compile -Xlint:all -Werror ModulePathTest2.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ModulePathTest2 */ diff --git a/test/jdk/tools/jpackage/share/ModulePathTest3.java b/test/jdk/tools/jpackage/share/ModulePathTest3.java index 118dc2e5ed01f..c3960c0d4c890 100644 --- a/test/jdk/tools/jpackage/share/ModulePathTest3.java +++ b/test/jdk/tools/jpackage/share/ModulePathTest3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -46,7 +46,7 @@ * @summary jpackage for app's module linked in external runtime * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile ModulePathTest3.java + * @compile -Xlint:all -Werror ModulePathTest3.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=ModulePathTest3 */ @@ -108,7 +108,7 @@ private void testIt(String mainAppDesc) throws XPathExpressionException, } @Parameters - public static Collection data() { + public static Collection data() { final List paths = new ArrayList<>(); paths.add(new String[] { "", "" }); if (TKit.isOSX()) { diff --git a/test/jdk/tools/jpackage/share/MultiLauncherTwoPhaseTest.java b/test/jdk/tools/jpackage/share/MultiLauncherTwoPhaseTest.java index 34962b77ca03f..d348b5c170dee 100644 --- a/test/jdk/tools/jpackage/share/MultiLauncherTwoPhaseTest.java +++ b/test/jdk/tools/jpackage/share/MultiLauncherTwoPhaseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -46,7 +46,7 @@ * @library /test/jdk/tools/jpackage/helpers * @key jpackagePlatformPackage * @build jdk.jpackage.test.* - * @compile MultiLauncherTwoPhaseTest.java + * @compile -Xlint:all -Werror MultiLauncherTwoPhaseTest.java * @run main/othervm/timeout=360 -Xmx512m * jdk.jpackage.test.Main * --jpt-run=MultiLauncherTwoPhaseTest diff --git a/test/jdk/tools/jpackage/share/MultiNameTwoPhaseTest.java b/test/jdk/tools/jpackage/share/MultiNameTwoPhaseTest.java index 870804661a7f8..8becb6f3dc325 100644 --- a/test/jdk/tools/jpackage/share/MultiNameTwoPhaseTest.java +++ b/test/jdk/tools/jpackage/share/MultiNameTwoPhaseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -45,7 +45,7 @@ * @key jpackagePlatformPackage * @requires (jpackage.test.SQETest == null) * @build jdk.jpackage.test.* - * @compile MultiNameTwoPhaseTest.java + * @compile -Xlint:all -Werror MultiNameTwoPhaseTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=MultiNameTwoPhaseTest */ diff --git a/test/jdk/tools/jpackage/share/MultipleJarAppTest.java b/test/jdk/tools/jpackage/share/MultipleJarAppTest.java index 0726b131d69e7..a3a50b7c47024 100644 --- a/test/jdk/tools/jpackage/share/MultipleJarAppTest.java +++ b/test/jdk/tools/jpackage/share/MultipleJarAppTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -22,19 +22,18 @@ */ -import java.nio.file.Path; -import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.Annotations.Parameter; +import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.HelloApp; -import jdk.jpackage.test.JavaAppDesc; import jdk.jpackage.test.JPackageCommand; +import jdk.jpackage.test.JavaAppDesc; /* * @test * @summary jpackage application packed in multiple jars * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile MultipleJarAppTest.java + * @compile -Xlint:all -Werror MultipleJarAppTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=MultipleJarAppTest */ diff --git a/test/jdk/tools/jpackage/share/NoMPathRuntimeTest.java b/test/jdk/tools/jpackage/share/NoMPathRuntimeTest.java index 3731997118334..916799459256c 100644 --- a/test/jdk/tools/jpackage/share/NoMPathRuntimeTest.java +++ b/test/jdk/tools/jpackage/share/NoMPathRuntimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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,7 +27,6 @@ import java.util.Collection; import java.util.ArrayList; import java.util.List; -import java.util.stream.Stream; import java.nio.file.Path; import jdk.jpackage.test.Annotations.Parameters; import jdk.jpackage.test.Annotations.Test; @@ -44,7 +43,7 @@ * @summary test '--runtime-image' option of jpackage * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile NoMPathRuntimeTest.java + * @compile -Xlint:all -Werror NoMPathRuntimeTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=NoMPathRuntimeTest */ @@ -111,7 +110,7 @@ public void test() throws IOException { } @Parameters - public static Collection data() { + public static Collection data() { final List paths = new ArrayList<>(); paths.add(new String[] { "", "" }); diff --git a/test/jdk/tools/jpackage/share/NonExistentTest.java b/test/jdk/tools/jpackage/share/NonExistentTest.java index 4d50f2a5850ae..3c87d3c6411c7 100644 --- a/test/jdk/tools/jpackage/share/NonExistentTest.java +++ b/test/jdk/tools/jpackage/share/NonExistentTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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,7 +34,7 @@ * @summary jpackage application version testing * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile NonExistentTest.java + * @compile -Xlint:all -Werror NonExistentTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=NonExistentTest */ @@ -45,7 +45,7 @@ public final class NonExistentTest { private final JPackageCommand cmd; @Parameters - public static Collection input() { + public static Collection input() { return List.of(new Object[][]{ // non-existent icon {"Hello", diff --git a/test/jdk/tools/jpackage/share/PerUserCfgTest.java b/test/jdk/tools/jpackage/share/PerUserCfgTest.java index 2e62aa5c5d631..080df1f959d3e 100644 --- a/test/jdk/tools/jpackage/share/PerUserCfgTest.java +++ b/test/jdk/tools/jpackage/share/PerUserCfgTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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,6 +25,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.Objects; import java.util.Optional; import jdk.jpackage.test.AdditionalLauncher; import jdk.jpackage.test.PackageTest; @@ -47,7 +48,7 @@ * @key jpackagePlatformPackage * @requires jpackage.test.SQETest == null * @build jdk.jpackage.test.* - * @compile PerUserCfgTest.java + * @compile -Xlint:all -Werror PerUserCfgTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=PerUserCfgTest */ @@ -165,6 +166,8 @@ private static void withConfigFile(JPackageCommand cmd, Path srcCfgFile, null).getFileName()); TKit.assertPathExists(targetCfgFile, false); try (var dirCleaner = TKit.createDirectories(targetCfgFile.getParent())) { + // Suppress "warning: [try] auto-closeable resource dirCleaner is never referenced" + Objects.requireNonNull(dirCleaner); Files.copy(srcCfgFile, targetCfgFile); try { TKit.traceFileContents(targetCfgFile, "cfg file"); diff --git a/test/jdk/tools/jpackage/share/PredefinedAppImageErrorTest.java b/test/jdk/tools/jpackage/share/PredefinedAppImageErrorTest.java index 0e1d358dae46b..a415f0370ccec 100644 --- a/test/jdk/tools/jpackage/share/PredefinedAppImageErrorTest.java +++ b/test/jdk/tools/jpackage/share/PredefinedAppImageErrorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -39,7 +39,7 @@ * @summary Test jpackage output for erroneous input with --type "app-image" and --app-image * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile PredefinedAppImageErrorTest.java + * @compile -Xlint:all -Werror PredefinedAppImageErrorTest.java * * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=PredefinedAppImageErrorTest @@ -56,7 +56,7 @@ public final class PredefinedAppImageErrorTest { private final JPackageCommand cmd; @Parameters - public static Collection input() throws IOException { + public static Collection input() throws IOException { return List.of(new Object[][]{ // --mac-sign is required {"Hello", diff --git a/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java index 75ad34807fdc0..c41ba92c74060 100644 --- a/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java +++ b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java @@ -43,7 +43,7 @@ * @key jpackagePlatformPackage * @requires (os.family != "windows") * @build jdk.jpackage.test.* - * @compile RuntimeImageSymbolicLinksTest.java + * @compile -Xlint:all -Werror RuntimeImageSymbolicLinksTest.java * @run main/othervm/timeout=1400 -Xmx512m jdk.jpackage.test.Main * --jpt-run=RuntimeImageSymbolicLinksTest */ diff --git a/test/jdk/tools/jpackage/share/RuntimeImageTest.java b/test/jdk/tools/jpackage/share/RuntimeImageTest.java index a80018603bf4e..0e30d7ee179c4 100644 --- a/test/jdk/tools/jpackage/share/RuntimeImageTest.java +++ b/test/jdk/tools/jpackage/share/RuntimeImageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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,7 +35,7 @@ * @library /test/jdk/tools/jpackage/helpers * @key jpackagePlatformPackage * @build jdk.jpackage.test.* - * @compile RuntimeImageTest.java + * @compile -Xlint:all -Werror RuntimeImageTest.java * @run main/othervm/timeout=1400 jdk.jpackage.test.Main * --jpt-run=RuntimeImageTest */ diff --git a/test/jdk/tools/jpackage/share/RuntimePackageTest.java b/test/jdk/tools/jpackage/share/RuntimePackageTest.java index 9c892bb9b1646..7b0e88a5ae71b 100644 --- a/test/jdk/tools/jpackage/share/RuntimePackageTest.java +++ b/test/jdk/tools/jpackage/share/RuntimePackageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -59,7 +59,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (jpackage.test.SQETest == null) - * @compile RuntimePackageTest.java + * @compile -Xlint:all -Werror RuntimePackageTest.java * @run main/othervm/timeout=1400 -Xmx512m jdk.jpackage.test.Main * --jpt-run=RuntimePackageTest */ @@ -71,7 +71,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (jpackage.test.SQETest != null) - * @compile RuntimePackageTest.java + * @compile -Xlint:all -Werror RuntimePackageTest.java * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=RuntimePackageTest.test */ diff --git a/test/jdk/tools/jpackage/share/ServiceTest.java b/test/jdk/tools/jpackage/share/ServiceTest.java index f1ff65d18b1a2..98cad9fc61094 100644 --- a/test/jdk/tools/jpackage/share/ServiceTest.java +++ b/test/jdk/tools/jpackage/share/ServiceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -49,7 +49,7 @@ * @build jdk.jpackage.test.* * @build jtreg.SkippedException * @key jpackagePlatformPackage - * @compile ServiceTest.java + * @compile -Xlint:all -Werror ServiceTest.java * @run main/othervm/timeout=360 -Xmx512m * jdk.jpackage.test.Main * --jpt-run=ServiceTest diff --git a/test/jdk/tools/jpackage/share/SimplePackageTest.java b/test/jdk/tools/jpackage/share/SimplePackageTest.java index e3945b668e0e0..c28c1c17798ff 100644 --- a/test/jdk/tools/jpackage/share/SimplePackageTest.java +++ b/test/jdk/tools/jpackage/share/SimplePackageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -43,7 +43,7 @@ * @library /test/jdk/tools/jpackage/helpers * @key jpackagePlatformPackage * @build jdk.jpackage.test.* - * @compile SimplePackageTest.java + * @compile -Xlint:all -Werror SimplePackageTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=SimplePackageTest */ diff --git a/test/jdk/tools/jpackage/share/UnicodeArgsTest.java b/test/jdk/tools/jpackage/share/UnicodeArgsTest.java index 6fa2717d15e7e..c168916ee7db3 100644 --- a/test/jdk/tools/jpackage/share/UnicodeArgsTest.java +++ b/test/jdk/tools/jpackage/share/UnicodeArgsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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,7 +34,7 @@ * @summary test how app launcher handles unicode command line arguments * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* - * @compile UnicodeArgsTest.java + * @compile -Xlint:all -Werror UnicodeArgsTest.java * @requires (os.family == "windows") * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=UnicodeArgsTest diff --git a/test/jdk/tools/jpackage/share/VendorTest.java b/test/jdk/tools/jpackage/share/VendorTest.java index 4c3a0ffcee26e..b6974cb286a25 100644 --- a/test/jdk/tools/jpackage/share/VendorTest.java +++ b/test/jdk/tools/jpackage/share/VendorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -58,7 +58,7 @@ * @requires (os.family == "windows") * @requires jpackage.test.SQETest != null * @build jdk.jpackage.test.* - * @compile VendorTest.java + * @compile -Xlint:all -Werror VendorTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=VendorTest */ @@ -71,7 +71,7 @@ * @requires (os.family != "mac") * @requires jpackage.test.SQETest == null * @build jdk.jpackage.test.* - * @compile VendorTest.java + * @compile -Xlint:all -Werror VendorTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=VendorTest */ diff --git a/test/jdk/tools/jpackage/windows/Win8282351Test.java b/test/jdk/tools/jpackage/windows/Win8282351Test.java index 17ea5e7d9ab1a..553574377628b 100644 --- a/test/jdk/tools/jpackage/windows/Win8282351Test.java +++ b/test/jdk/tools/jpackage/windows/Win8282351Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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,7 +27,6 @@ import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.Annotations.Test; -import jdk.jpackage.test.PackageType; import jdk.jpackage.test.RunnablePackageTest.Action; import jdk.jpackage.test.TKit; diff --git a/test/jdk/tools/jpackage/windows/WinConsoleTest.java b/test/jdk/tools/jpackage/windows/WinConsoleTest.java index 6a1e94a8e83ef..1244de080d996 100644 --- a/test/jdk/tools/jpackage/windows/WinConsoleTest.java +++ b/test/jdk/tools/jpackage/windows/WinConsoleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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,7 @@ * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinConsoleTest.java + * @compile -Xlint:all -Werror WinConsoleTest.java * * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault diff --git a/test/jdk/tools/jpackage/windows/WinInstallerIconTest.java b/test/jdk/tools/jpackage/windows/WinInstallerIconTest.java index f104abc9f5e6b..fe6ee650f4ab3 100644 --- a/test/jdk/tools/jpackage/windows/WinInstallerIconTest.java +++ b/test/jdk/tools/jpackage/windows/WinInstallerIconTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -62,7 +62,7 @@ public void test() { // Create another installer with custom icon. var size3 = createInstaller(customIcon, null); - if (Stream.of(size1, size2, size3).allMatch(Optional::isEmpty)) { + if (Stream.of(size1, size2, size3).allMatch(Optional::isEmpty)) { TKit.trace( "Not verifying sizes of installers because they were not created"); return; diff --git a/test/jdk/tools/jpackage/windows/WinL10nTest.java b/test/jdk/tools/jpackage/windows/WinL10nTest.java index dee1e42267d91..4f5a27f9ff096 100644 --- a/test/jdk/tools/jpackage/windows/WinL10nTest.java +++ b/test/jdk/tools/jpackage/windows/WinL10nTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -46,7 +46,7 @@ * @requires (jpackage.test.SQETest == null) * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinL10nTest.java + * @compile -Xlint:all -Werror WinL10nTest.java * @run main/othervm/timeout=1440 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinL10nTest */ diff --git a/test/jdk/tools/jpackage/windows/WinLongPathTest.java b/test/jdk/tools/jpackage/windows/WinLongPathTest.java index 10e713f02a8cf..8fe347cffda13 100644 --- a/test/jdk/tools/jpackage/windows/WinLongPathTest.java +++ b/test/jdk/tools/jpackage/windows/WinLongPathTest.java @@ -45,7 +45,7 @@ * @build jdk.jpackage.test.* * @build jtreg.SkippedException * @requires (os.family == "windows") - * @compile WinLongPathTest.java + * @compile -Xlint:all -Werror WinLongPathTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-space-subst=* * --jpt-exclude=WinLongPathTest(false,*--temp) diff --git a/test/jdk/tools/jpackage/windows/WinLongVersionTest.java b/test/jdk/tools/jpackage/windows/WinLongVersionTest.java index 7a915b5c123fd..d70cda7b26452 100644 --- a/test/jdk/tools/jpackage/windows/WinLongVersionTest.java +++ b/test/jdk/tools/jpackage/windows/WinLongVersionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -74,7 +74,7 @@ * @requires (jpackage.test.SQETest != null) * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinLongVersionTest.java + * @compile -Xlint:all -Werror WinLongVersionTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinLongVersionTest.test */ @@ -87,7 +87,7 @@ * @requires (jpackage.test.SQETest == null) * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinLongVersionTest.java + * @compile -Xlint:all -Werror WinLongVersionTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinLongVersionTest */ diff --git a/test/jdk/tools/jpackage/windows/WinMenuGroupTest.java b/test/jdk/tools/jpackage/windows/WinMenuGroupTest.java index bdf5cf2f0a5e2..64533b72c09e9 100644 --- a/test/jdk/tools/jpackage/windows/WinMenuGroupTest.java +++ b/test/jdk/tools/jpackage/windows/WinMenuGroupTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -21,7 +21,6 @@ * questions. */ -import jdk.jpackage.test.TKit; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.Annotations.Test; @@ -43,7 +42,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinMenuGroupTest.java + * @compile -Xlint:all -Werror WinMenuGroupTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinMenuGroupTest */ diff --git a/test/jdk/tools/jpackage/windows/WinMenuTest.java b/test/jdk/tools/jpackage/windows/WinMenuTest.java index 8bacaa054706d..a9240f611739b 100644 --- a/test/jdk/tools/jpackage/windows/WinMenuTest.java +++ b/test/jdk/tools/jpackage/windows/WinMenuTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -21,7 +21,6 @@ * questions. */ -import jdk.jpackage.test.TKit; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.Annotations.Test; @@ -40,7 +39,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinMenuTest.java + * @compile -Xlint:all -Werror WinMenuTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinMenuTest */ diff --git a/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java b/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java index 48fca9644ea98..dc68b63aa96d5 100644 --- a/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java +++ b/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -41,7 +41,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinPerUserInstallTest.java + * @compile -Xlint:all -Werror WinPerUserInstallTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinPerUserInstallTest */ diff --git a/test/jdk/tools/jpackage/windows/WinResourceTest.java b/test/jdk/tools/jpackage/windows/WinResourceTest.java index db897e1aa694d..b34521403f30b 100644 --- a/test/jdk/tools/jpackage/windows/WinResourceTest.java +++ b/test/jdk/tools/jpackage/windows/WinResourceTest.java @@ -45,7 +45,7 @@ * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinResourceTest.java + * @compile -Xlint:all -Werror WinResourceTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinResourceTest */ diff --git a/test/jdk/tools/jpackage/windows/WinScriptTest.java b/test/jdk/tools/jpackage/windows/WinScriptTest.java index 98b4922826dda..45068ffd39552 100644 --- a/test/jdk/tools/jpackage/windows/WinScriptTest.java +++ b/test/jdk/tools/jpackage/windows/WinScriptTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -39,7 +39,7 @@ * @library /test/jdk/tools/jpackage/helpers * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinScriptTest.java + * @compile -Xlint:all -Werror WinScriptTest.java * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinScriptTest */ @@ -102,6 +102,9 @@ public void test(int wsfExitCode) throws IOException { msiScriptData.assertJPackageOutput(result.getOutput()); }); break; + + default: + throw new UnsupportedOperationException(); } test.run(); diff --git a/test/jdk/tools/jpackage/windows/WinShortcutTest.java b/test/jdk/tools/jpackage/windows/WinShortcutTest.java index 1d2e7e762a533..6e6981ccf9b6c 100644 --- a/test/jdk/tools/jpackage/windows/WinShortcutTest.java +++ b/test/jdk/tools/jpackage/windows/WinShortcutTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -21,7 +21,6 @@ * questions. */ -import jdk.jpackage.test.TKit; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.Annotations.Test; @@ -41,7 +40,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinShortcutTest.java + * @compile -Xlint:all -Werror WinShortcutTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinShortcutTest */ diff --git a/test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java b/test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java index c48803cfb5f67..76f691aa84a90 100644 --- a/test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java +++ b/test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -51,7 +51,7 @@ * @requires (jpackage.test.SQETest != null) * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinUpgradeUUIDTest.java + * @compile -Xlint:all -Werror WinUpgradeUUIDTest.java * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinUpgradeUUIDTest.test */ @@ -64,7 +64,7 @@ * @requires (jpackage.test.SQETest == null) * @build jdk.jpackage.test.* * @requires (os.family == "windows") - * @compile WinUpgradeUUIDTest.java + * @compile -Xlint:all -Werror WinUpgradeUUIDTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main * --jpt-run=WinUpgradeUUIDTest */