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

Mandy Chung mchung at openjdk.org
Wed Jun 14 16:30:59 UTC 2023


On Wed, 14 Jun 2023 07:12:13 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Class.java line 928:
>> 
>>> 926:      * @apiNote
>>> 927:      * This is not a strict inverse of {@link #forName(String) forName}.
>>> 928:      * For normal classes, distinct classes which share a common name but
>> 
>> Readers may wonder what "normal classes" means here, it might be simpler to just drop introducing that term and just use the structure from the note removed from descriptorString.
>
> This might wish to refer to "classes that can be described nominally", but same might be said for hidden classes as well. So your suggestion is better.

What about:


     * This is not a strict inverse of {@link #forName(String) forName}.
     * Distinct classes which share a common name but have different class
     * loaders will have the identical name. {@linkplain #isHidden() Hidden}
     * classes cannot be discovered by {@code forName}.

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

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


More information about the core-libs-dev mailing list