RFR: 8349564: Clean warnings found in jpackage tests when building them with -Xlint:all [v2]

Alexander Matveev almatvee at openjdk.org
Thu Feb 6 22:55:11 UTC 2025


On Thu, 6 Feb 2025 19:36:27 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:

>> Clean warnings found in jpackage tests when building them with `-Xlint:all` option in Eclipse IDE. 
>> 
>> They are:
>>  - redundant imports (solution: remove)
>>  - unused function/fields (solution: remove)
>>  - missing SuppressWarnings-s (solution: add what is missing)
>>  - redundant SuppressWarnings-s (solution: remove)
>>  - raw types used (solution: use wildcard or more specific types if appropriate)
>>  - generic varargs (solution: convert to single/double/list arguments)
>>  - an incomplete list of enum elements in switch statements (solution: add `default` branch)
>> 
>> To prevent regression, added `-Xlint:all -Werror` to the compiler command line of all jpackage tests
>
> Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision:
> 
>   More cleanup

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java line 299:

> 297:     }
> 298: 
> 299:     // Wraps Method.invike() into ThrowingRunnable.run()

`invike` -> `invoke`.

test/jdk/tools/jpackage/share/JavaOptionsTest.java line 38:

> 36:  * @summary jpackage create image with --java-options test
> 37:  * @library /test/jdk/tools/jpackage/helpers
> 38:  * @build jdk.jpackage.test.*

Helper classes will be build without `-Xlint:all -Werror`, right? If yes do we need to add `-Xlint:all -Werror` as well when building helper classes?

test/jdk/tools/jpackage/share/JavaOptionsTest.java line 39:

> 37:  * @library /test/jdk/tools/jpackage/helpers
> 38:  * @build jdk.jpackage.test.*
> 39:  * @compile -Xlint:all -Werror JavaOptionsTest.java

Can we add `-Xlint:all -Werror` in generic way instead of repeating each time?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23455#discussion_r1945570982
PR Review Comment: https://git.openjdk.org/jdk/pull/23455#discussion_r1945583133
PR Review Comment: https://git.openjdk.org/jdk/pull/23455#discussion_r1945582226


More information about the core-libs-dev mailing list