RFR: 8341483: Clarify special case handling of Types.getArrayType

Joe Darcy darcy at openjdk.org
Fri Oct 4 04:16:07 UTC 2024


On Fri, 4 Oct 2024 04:10:20 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Add specification and tests for invalid inputs to getArrayType that generation an exception. As initially written, this PR changes the behavior on NONE and the null type.

Different sections of the JLS imply an array of null type is outside of the language:

Per JLS 10.1:

"An array type is written as the name of an element type followed by some number of empty pairs of square brackets []"

Therefore, since the null type is not denotable, in other words from JLS 4.1

"Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type. "

it is not possible to declare an array of null type.

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

PR Comment: https://git.openjdk.org/jdk/pull/21346#issuecomment-2392752997


More information about the compiler-dev mailing list