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

Mandy Chung mchung at openjdk.org
Thu Jun 15 02:16:59 UTC 2023


On Thu, 15 Jun 2023 02:01:18 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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}.
>
> On a second thought, these are all `getName` results that cannot be parsed by `forName`:
>  - Primitive type names
>  - Hidden class names
>  - Arrays whose component types are hidden classes
> 
> I suggest:
> 
>      * This is not a strict inverse of {@link #forName(String) forName(String)}.
>      * Distinct classes which share a common name but have different class
>      * loaders will have the identical name. {@linkplain #isPrimitive()
>      * Primitive types}, {@linkplain #isHidden() hidden} classes, and arrays
>      * with hidden class as element types cannot be discovered by {@code forName}.

That reads fine with one minor tweak:

... and array classes whose element type is a hidden class or interface cannot be discovered by {@code forName}.

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

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


More information about the core-libs-dev mailing list