[lworld] RFR: 8351362: Post-process @Strict annotation for testing [v3]
Dan Smith
dlsmith at openjdk.org
Wed Mar 19 16:04:27 UTC 2025
On Wed, 19 Mar 2025 14:20:44 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> The idea is that the `@Strict` annotation should live next to the tool that interprets it.
>>
>> If we decide we need a translation tool in `jdk.internal`, then putting `@Strict` there too makes sense. If this is purely a test-writing tool, then `@Strict` belongs in tests.
>>
>> `@NullRestricted` is interpret by the JVM, so it makes sense that it lives in the JVM's internal API.
>
> It has been said that in tests every NullRestricted annotated element should also have @Strict.
> Since @Strict is there only for test generation; would it be simpler to have the tool look for NullRestricted and do the right thing; avoiding both excessive editing of tests and parallel but dependent annotations.
Possibly, yes. The trade-off is then it's harder or confusing to write tests of validation behavior—when you explicitly want a class file that has `@NullRestricted` but not ACC_STRICT. Maybe that's a corner case we can deal with though. It also obscures the dependency on the translation tool (importing the test library is a helpful signal that you intend to use the translation tool). But, sure, that's a possible enhancement.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1395#discussion_r2003711045
More information about the valhalla-dev
mailing list