RFR: JDK-8304163: Move jdk.internal.module.ModuleInfoWriter to the test library [v2]

Mandy Chung mchung at openjdk.org
Mon Mar 20 17:12:56 UTC 2023


On Mon, 20 Mar 2023 06:57:32 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> test/jdk/java/lang/ModuleTests/AnnotationsTest.java line 61:
>> 
>>> 59:  *          java.base/jdk.internal.module
>>> 60:  * @library /test/lib
>>> 61:  * @build jdk.test.lib.util.ModuleInfoWriter
>> 
>> You don't need to build library classes explicitly. I think @library /test/lib it enough.
>
> Hello @lmesnik, on the contrary, these build directives are recommended (and based on some of the issues we have encountered, are in fact necessary). The jtreg documentation has this to say https://openjdk.org/jtreg/tag-spec.html:
> 
>> In general, classes in library directories are not automatically compiled as part of a compilation command explicitly naming the source files containing those classes. A test that relies upon library classes should contain appropriate @build directives to ensure that the classes will be compiled. It is strongly recommended that tests do not rely on the use of implicit compilation by the Java compiler. Such an approach is generally fragile, and may lead to incomplete recompilation when a test or library code has been modified.

Explicit compilation is exactly the reason of adding `@build`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13085#discussion_r1142447529


More information about the serviceability-dev mailing list