On Fri, 6 Sep 2024 12:40:15 GMT, Nizar Benalla <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/classfile/AnnotationValue.java line
>> 681:
>>
>>> 679: */
>>> 680: static AnnotationValue of(Object value) {
>>> 681: requireNonNull(value);
>>
>> Below is a null test throwing IAE.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20556#discussion_r1747146758