RFR: 8263536: Add missing @compile tags to jpackage tests [v2]

Ioi Lam iklam at openjdk.java.net
Mon Mar 15 20:05:08 UTC 2021


On Mon, 15 Mar 2021 19:55:03 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> It is better to have `@compile` everywhere for consistency. 
>> 
>> The proper way to run tests is by passing test class name as an argument for test runner, test class should not have `main()` and should have `@Test` annotation for test methods. Some tests have not been updated to follow this design and adding `@compile` to them doesn't make a difference now. But eventually they will be updated and they will need `@compile` anyways.
>
> If this is the plan please update the bug description to reflect this. Otherwise it's not clear why this is done. The `@compile` in those files aren't really "missing" since they are not required. I would suggest changing the bug title to "Add @compile tags to jpackage tests"

> adding `@compile` to them doesn't make a difference now

Also, the above is not true. `@compile` will always run javac every time you run the test. I think you should use `@build` instead -- if the class doesn't exist, it will be compiled. If it already exists (you run jtreg a second time), the class won't be compiled again, so it will run a little faster.

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

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


More information about the core-libs-dev mailing list