RFR: 8310242: Clarify the name parameter to Class::forName [v7]
Chen Liang
liach at openjdk.org
Thu Jun 22 17:19:08 UTC 2023
On Thu, 22 Jun 2023 16:49:05 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Class.java line 426:
>>
>>> 424: /**
>>> 425: * Returns the {@code Class} object associated with the class or
>>> 426: * interface with the given string name, using the given class loader.
>>
>> Should we update the summary to `... associated with the class or interface or array with the given string name...`
>
> I want to keep it as is. The first paragraph talks about a class or interface and the other paragraphs talk about array classes, primitive types and hidden classes.
Indeed, this API is more suited to classes and intefaces discovery, and array types should be obtained via `arrayType()`, which is somehow faster than a direct forName (as seen in my ClassDesc.resolveConstantDesc benchmarks)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14528#discussion_r1238821443
More information about the core-libs-dev
mailing list