RFR: 8309819: Clarify API note in Class::getName and MethodType::toMethodDescriptorString [v5]

Chen Liang liach at openjdk.org
Thu Jun 15 23:36:05 UTC 2023


On Thu, 15 Jun 2023 16:32:27 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Class.java line 933:
>> 
>>> 931:      * classes whose element type is a hidden class or interface cannot be
>>> 932:      * discovered by {@code forName}.
>>> 933:      *
>> 
>> This is an API note in Class::getName. It seems excessive to be saying that primitive types, hidden classes, ... can't be discovered with Class.forName. It might be better to just drop the second half of this note.
>
> I think so too.  The spec describes the result of a hidden class is of the form: `{@code N + '/' + <suffix>}`.  If really needed, we can add in that bullet saying "The result is not a binary name."

The 3-arg forName specifies it uses the 'getName' format. It's good to update that to refer to binary names, but that API can find array classes, and array classes aren't quite binary names.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14411#discussion_r1231625796


More information about the core-libs-dev mailing list