JDK-8319046 : Execute tests in source/class-file order in JavadocTester
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2023-10-27
  • Updated: 2023-10-27
Related Reports
Blocks :  
Description
Currently, the default set of test cases executed by JavadocTester are executed in the undefined/random order given by getDeclaredMethods.

It would be more helpful/convenient to execute the test cases in source-file order, 

Since javac generates methods in a class file in the same order that they appear in the corresponding source file, we can use the order of methods in the class file as a proxy for the order in the source file.
Comments
As nice as this would be to have right now, sorting methods by class file order requires access to a class file library, either `com.sun.tools.classfile` or (preferably) the new class file library currently in `jdk.internal.classfile`. Using either of these would require editing the `@modules` tag in ~285 tests, i.e. all the tests that extend `JavadocTester`. And that is probably not worth the churn. Even when JDK-8308753 is integrated and the new library moves to its intended home of `java.lang.classfile` the API will still be in preview for a while, requiring an `@enablePreview` tag in the tests. Scanning the source file, e.g. with Patterns, works most of the time but there are some meta-tests (actually, just 1: TestRunTests.java) that run like-named methods in nested classes, which defeats simple analysis but can be hacked around.
27-10-2023