RFR: 8343876: Enhancements to jpackage test lib [v3]

Alexey Semenyuk asemenyuk at openjdk.org
Fri Nov 15 15:10:12 UTC 2024


On Fri, 15 Nov 2024 01:20:34 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

>> Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove redundant "method.setAccessible(true);" calls
>
> test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestMethodSupplier.java line 433:
> 
>> 431:                     withTestAnnotations = true;
>> 432:                 }
>> 433:                 verifyAnnotationsCorrect(method);
> 
> This code blocks looks confusing. Why we need `method.setAccessible(true)` for all methods? Also, `if` statement looks confusing with empty `if (withTestAnnotations).`

Good point about `method.setAccessible(true)`!
Looks like it is needed when `Method::invoke()` is used, but not when querying annotations. Removed redundant `method.setAccessible(true)` calls.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21996#discussion_r1843967405


More information about the core-libs-dev mailing list