RFR: JDK-8283075: Bad IllegalArgumentException message when calling ClassDesc.arrayType(int) which results in a rank > 255

Vicente Romero vromero at openjdk.java.net
Mon Mar 14 20:26:46 UTC 2022


On Mon, 14 Mar 2022 19:56:17 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Improving the exception messages for out-of-supported-range array types.
> 
> I'll update copyrights before pushing.

src/java.base/share/classes/java/lang/constant/ClassDesc.java line 186:

> 184:         if (rank <= 0 || netRank > ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS)
> 185:             throw new IllegalArgumentException("rank: " + netRank +
> 186:                                                " exceeds maximum supported dimension of " +

if the `rank < 0` it won't be exceeding the maximum supported dimensions so this message only applies to the second condition

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

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


More information about the core-libs-dev mailing list