RFR: 8317356: Test ClassFile API if it deals with nulls correctly across the whole API [v3]
Adam Sotona
asotona at openjdk.org
Fri Sep 6 13:49:53 UTC 2024
On Fri, 6 Sep 2024 13:39:43 GMT, Chen Liang <liach at openjdk.org> wrote:
>> The test fails if the method does not throw an exception or throws anything other than a NPE. That's why I added `requireNonNull` here.
>>
>> What exceptions would be considered ok when nulls are provided?
>
> I think we should prefer NPE instead of IAE for null inputs.
>
> I think we should just remove this method - the format for composite list/array or annotation is not well-defined. We might replace this with a `ofResolvedConstant` to accept primitives and String.
API method removal is not subject of this bug/PR, please discuss it on the mailing list.
Also throwing NPE instead of IAE is a subject for consideration, as it is a factory of AnnotationValue from an Object, where null might be considered as IAE.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20556#discussion_r1747156753
More information about the core-libs-dev
mailing list