RFR: 8268250: Class.arrayType() for a 255-d array throws undocumented IllegalArgumentException [v2]

Alan Bateman alanb at openjdk.java.net
Mon Jun 7 06:01:00 UTC 2021


On Mon, 7 Jun 2021 00:22:41 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Make explicit illegal argument cases of Class.arrayType.
>> 
>> Please also review the corresponding CSR: https://bugs.openjdk.java.net/browse/JDK-8268300
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add missing ending newline.

src/java.base/share/classes/java/lang/Class.java line 4440:

> 4438:      * @throws IllegalArgumentException if this component type is {@linkplain
> 4439:      *         Void#TYPE void} or if the number of dimensions of the resulting array
> 4440:      *         type would exceed 255.

This is a no-arg method so I'm not sure that IAE is the right exception. The method was added in Java 12 so there probably isn't a huge body of code that expects it to throw IAE, meaning it may be possible to change it with little/no impact.

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

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


More information about the core-libs-dev mailing list