RFR: 8310242: Clarify the name parameter to Class::forName [v4]

Chen Liang liach at openjdk.org
Mon Jun 19 13:17:05 UTC 2023


On Sat, 17 Jun 2023 13:56:15 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> This changes look okay but they do make me wonder if we should add a note to the 2-arg Class.forName to make it clear that it does not allow class names for array types, the class name has to be a binary name.

In its specification:
"This method attempts to locate and load the class or interface."

"Class or interface" already precludes array classes or primitive types (8 types + void). If we need, we can add that it doesn't find primitive types or array classes.

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

PR Comment: https://git.openjdk.org/jdk/pull/14528#issuecomment-1597172838


More information about the core-libs-dev mailing list