Skip to content

Commit efc597b

Browse files
author
Alexey Semenyuk
committed
8349564: Clean warnings found in jpackage tests when building them with -Xlint:all
Reviewed-by: almatvee
1 parent 29202d1 commit efc597b

File tree

83 files changed

+301
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+301
-280
lines changed

test/jdk/tools/jpackage/apps/ChildProcessAppLauncher.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,9 +21,7 @@
2121
* questions.
2222
*/
2323

24-
import java.io.File;
2524
import java.io.IOException;
26-
import java.nio.file.Path;
2725

2826
public class ChildProcessAppLauncher {
2927
public static void main(String[] args) throws IOException, InterruptedException {

test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/AnnotationsTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,6 @@
3535
import static java.util.stream.Collectors.toMap;
3636
import java.util.stream.Stream;
3737
import jdk.internal.util.OperatingSystem;
38-
import static jdk.internal.util.OperatingSystem.LINUX;
3938
import jdk.jpackage.test.Annotations.Parameter;
4039
import jdk.jpackage.test.Annotations.ParameterSupplier;
4140
import jdk.jpackage.test.Annotations.Parameters;
@@ -52,12 +51,12 @@
5251
public class AnnotationsTest {
5352

5453
public static void main(String... args) {
55-
runTests(BasicTest.class, ParameterizedInstanceTest.class);
54+
runTests(List.of(BasicTest.class, ParameterizedInstanceTest.class));
5655
for (var os : OperatingSystem.values()) {
5756
try {
5857
TestBuilderConfig.setOperatingSystem(os);
5958
TKit.log("Current operating system: " + os);
60-
runTests(IfOSTest.class);
59+
runTests(List.of(IfOSTest.class));
6160
} finally {
6261
TestBuilderConfig.setDefaults();
6362
}
@@ -301,17 +300,17 @@ public static Collection<Object[]> dateSupplier() {
301300
});
302301
}
303302

304-
private static void runTests(Class<? extends TestExecutionRecorder>... tests) {
303+
private static void runTests(List<Class<? extends TestExecutionRecorder>> tests) {
305304
ACTUAL_TEST_DESCS.get().clear();
306305

307-
var expectedTestDescs = Stream.of(tests)
306+
var expectedTestDescs = tests.stream()
308307
.map(AnnotationsTest::getExpectedTestDescs)
309308
.flatMap(x -> x)
310309
// Collect in the map to check for collisions for free
311310
.collect(toMap(x -> x, x -> ""))
312311
.keySet();
313312

314-
var args = Stream.of(tests).map(test -> {
313+
var args = tests.stream().map(test -> {
315314
return String.format("--jpt-run=%s", test.getName());
316315
}).toArray(String[]::new);
317316

@@ -324,6 +323,7 @@ private static void runTests(Class<? extends TestExecutionRecorder>... tests) {
324323
}
325324
}
326325

326+
@SuppressWarnings("unchecked")
327327
private static Stream<String> getExpectedTestDescs(Class<?> type) {
328328
return toSupplier(() -> {
329329
var method = type.getMethod("getExpectedTestDescs");

test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/DirectoryContentVerifierTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -106,7 +106,7 @@ ArgsBuilder expectFail() {
106106
}
107107

108108
@Parameters
109-
public static Collection input() {
109+
public static Collection<?> input() {
110110
List<Object[]> data = new ArrayList<>();
111111
buildArgs().applyVariantsTo(data);
112112
buildArgs().actualPaths("foo").assertOp(CONTAINS).applyTo(data);

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -87,10 +87,15 @@ public final AdditionalLauncher setLauncherAsService() {
8787
}
8888

8989
public final AdditionalLauncher addRawProperties(
90-
Map.Entry<String, String>... v) {
90+
Map.Entry<String, String> v) {
9191
return addRawProperties(List.of(v));
9292
}
9393

94+
public final AdditionalLauncher addRawProperties(
95+
Map.Entry<String, String> v, Map.Entry<String, String> v2) {
96+
return addRawProperties(List.of(v, v2));
97+
}
98+
9499
public final AdditionalLauncher addRawProperties(
95100
Collection<Map.Entry<String, String>> v) {
96101
rawProperties.addAll(v);

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Comm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public static <T> Comm<T> compare(Set<T> a, Set<T> b) {
3434
unique1.removeAll(common);
3535
Set<T> unique2 = new HashSet<>(b);
3636
unique2.removeAll(common);
37-
return new Comm(common, unique1, unique2);
37+
return new Comm<T>(common, unique1, unique2);
3838
}
3939
}

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/CommandArguments.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,17 +36,17 @@ public class CommandArguments<T> {
3636

3737
public final T clearArguments() {
3838
args.clear();
39-
return (T) this;
39+
return thiz();
4040
}
4141

4242
public final T addArgument(String v) {
4343
args.add(v);
44-
return (T) this;
44+
return thiz();
4545
}
4646

4747
public final T addArguments(List<String> v) {
4848
args.addAll(v);
49-
return (T) this;
49+
return thiz();
5050
}
5151

5252
public final T addArgument(Path v) {
@@ -77,5 +77,10 @@ protected boolean isMutable() {
7777
return true;
7878
}
7979

80+
@SuppressWarnings("unchecked")
81+
private T thiz() {
82+
return (T) this;
83+
}
84+
8085
protected List<String> args;
8186
}

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ Result getValue() {
259259
return value;
260260
}
261261

262-
private final Result value;
262+
private final transient Result value;
263+
private static final long serialVersionUID = 1L;
263264
}
264265

265266
/*

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,18 +47,10 @@ public static Runnable identity(Runnable v) {
4747
return v;
4848
}
4949

50-
public static <T, R> Function<T, R> identity(Function<T, R> v) {
51-
return v;
52-
}
53-
5450
public static <T, R> Function<T, R> identityFunction(Function<T, R> v) {
5551
return v;
5652
}
5753

58-
public static <T> Predicate<T> identity(Predicate<T> v) {
59-
return v;
60-
}
61-
6254
public static <T> Predicate<T> identityPredicate(Predicate<T> v) {
6355
return v;
6456
}

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public AppOutputVerifier addParams(Map<String, String> v) {
393393
return addParams(v.entrySet());
394394
}
395395

396-
public AppOutputVerifier addParams(Map.Entry<String, String>... v) {
396+
public AppOutputVerifier addParams(Map.Entry<String, String> v) {
397397
return addParams(List.of(v));
398398
}
399399

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LauncherIconVerifier.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -264,7 +264,7 @@ private void setIcon(Path iconPath, Path launcherPath) {
264264

265265
static final WinIconVerifier instance = new WinIconVerifier();
266266

267-
private final Class executableRebranderClass;
267+
private final Class<?> executableRebranderClass;
268268
private final Method lockResource;
269269
private final Method unlockResource;
270270
private final Method iconSwapWrapper;

0 commit comments

Comments
 (0)