RFR: 8317356: Test ClassFile API if it deals with nulls correctly across the whole API

ExE Boss duke at openjdk.org
Fri Oct 11 09:38:11 UTC 2024


On Fri, 11 Oct 2024 07:55:44 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Please review this patch that adds a test by @nizarbenalla to perform null checks across the ClassFile API. This is an updated version of #20556 that minimizes impact on our implementation code.
>> 
>> Notes:
>> 1. There's one change in `MethodHandleProxies` to explicitly use platform class loader instead of `null` for boot class loader. Tests work fine.
>> 2. The null check test uses the same set of classes as CorpusTest to make it suitable for tier 1.
>> 3. The test is not comprehensive; currently it is permissive toward IAE, because sometimes some substitution arguments are invalid, especially primitive ClassDesc or Opcode with wrong types.
>
> test/jdk/jdk/classfile/NullHostileTest.java line 1:
> 
>> 1: /*
> 
> I'm a bit worried about maintainability of such complex parametrized test with hard-listed method signatures in a text form. I would recommend to find better location/category and tier for the test.

Perhaps the parameters could be annotated with a **JDK**‑internal `@Nullable` annotation, which would then be used by the test to determine whether the parameter is supposed to allow `null`s.

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

This would also ease future migration to [Null‑Restricted and Nullable Types].

[Null‑Restricted and Nullable Types]: https://openjdk.org/jeps/8303099

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21458#discussion_r1796699729


More information about the core-libs-dev mailing list