RFR: JDK-8272853: improve `JavadocTester.runTests`

Jonathan Gibbons jjg at openjdk.java.net
Thu Mar 3 01:06:03 UTC 2022


On Thu, 13 Jan 2022 16:23:38 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> Please review a medium simple test-only fix to improve the `JavadocTester` `runTests` methods.
>> 
>> Currently, there are two overloads: one to invoke no-args test methods, and another to invoke test methods with args, such as a method-specific `Path`.  This latter one is slightly inconvenient to use, since it requires the boilerplate use of a function to create the arguments.
>> 
>> The first overload is updated in a backwards compatible way, to examine the parameters of methods annotated with `@Test`, and to recognize common patterns: namely no-args methods and `(Path)` methods, without the need for any additional function.  The second overload is retained by backwards compatibility, until if and when we decide it is no longer required.
>> 
>> In addition, two new overloads are added, similar to the first two, but with the addition of an extra parameter to decide which methods should be invoked. This is primarily a debugging aid.  Using these overloads, it is easy to specify, on the command line used to run the test, the methods to be executed.
>> 
>> A new test is added to test the new functionality.
>
> Making the boilerplate to call test methods with a path object obsolete is a very welcome enhancement. Can and should we update existing tests that use the explicit method -> path function to the new form?
> 
> You say that the new forms that take a list of method names could be used by passing the method names as command line arguments. That functionality is not included in this PR as far as I can see. Is that planned for a later time?

@hns I tweaked the new "self-test" to address failures seen on some platforms.  
I weakened the constraint that `IllegalArgumentException` should _always_ be thrown before _any_ sub-tests are executed. While this may be good as a general principle, it doesn't work so well when the `ILA` comes from a nested call. Rather than twist the code so that `ILA` is always thrown early, I left `JavadocTester` alone, and just relaxed the code in `TestRunTests.java` to allow `ILA` to be thrown later, in some situations.

FWIW, the issue did not show up earlier, because the order of methods returned by `getDeclaredMethods` is explicitly undefined and may vary across platforms.

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

PR: https://git.openjdk.java.net/jdk/pull/6983


More information about the javadoc-dev mailing list