RFR: 8309819: Fix specification about descriptor inverses in Class and MethodType [v3]

Mandy Chung mchung at openjdk.org
Wed Jun 14 02:02:11 UTC 2023


On Wed, 14 Jun 2023 01:34:40 GMT, Chen Liang <liach at openjdk.org> wrote:

>> The API specification for descriptorString not being a strict inverse of Class::forName and MethodType::fromDescriptorString are not entirely correct.
>> 
>> 1. Class::descriptorString was never an inverse of Class::forName, which takes a binary name instead. Class::getName was a partial inverse instead.
>> 2. MethodType::toMethodDescriptorString ends with a meaningless sentence: "fromMethodDescriptorString, because the latter requires a suitable class loader argument.", and the "Note:" section can be replaced with an `@apiNote`.
>> 3. Both of these didn't mention hidden classes (or other non-nominally-describable classes) as a reason that prevents the inversion operation, in addition to distinct classloaders.
>> 
>> A few user-defined anchor links are replaced with updated javadoc link tag format as well. The explicit html-style links in `@see` tags are unchanged in order to retain the non-code output.
>> 
>> The rendered specifications:
>> https://cr.openjdk.org/~liach/8309819/02/java.base/java/lang/Class.html
>> https://cr.openjdk.org/~liach/8309819/02/java.base/java/lang/invoke/MethodType.html
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Address the other two review comments
>  - Merge branch 'fix/descstring-spec' of https://github.com/liachmodded/jdk into fix/descstring-spec
>  - Update src/java.base/share/classes/java/lang/Class.java
>    
>    Co-authored-by: Mandy Chung <mandy.chung at oracle.com>
>  - Merge branch 'master' into fix/descstring-spec
>  - 8309819: Fix specification about descriptor inverses in Class and MethodTypeDesc

Marked as reviewed by mchung (Reviewer).

src/java.base/share/classes/java/lang/invoke/MethodType.java line 1169:

> 1167:      * resolved by the given loader (or if it is null, on the system class loader).
> 1168:      * <p>
> 1169:      * Note that it is possible to encounter method types which cannot be

BTW this can be converted to `@apiNote` as well.

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

PR Review: https://git.openjdk.org/jdk/pull/14411#pullrequestreview-1478319920
PR Review Comment: https://git.openjdk.org/jdk/pull/14411#discussion_r1228884111


More information about the core-libs-dev mailing list