On Mon, 12 Jun 2023 07:58:29 GMT, Chen Liang <li...@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. The note about different class loaders is moved > to getName, as ClassDesc requires an explicit lookup for resolution already. > 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 class loaders. Added valid method type > descriptor/binary name as a prerequisite for the distinct class loader > explanation. > > 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/09/java.base/java/lang/Class.html > https://cr.openjdk.org/~liach/8309819/09/java.base/java/lang/invoke/MethodType.html This pull request has now been integrated. Changeset: 8c8e9d91 Author: Chen Liang <li...@openjdk.org> Committer: Mandy Chung <mch...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/8c8e9d911d388f6ee621ed4d322efc56a9876708 Stats: 47 lines in 2 files changed: 10 ins; 10 del; 27 mod 8309819: Clarify API note in Class::getName and MethodType::toMethodDescriptorString Reviewed-by: mchung ------------- PR: https://git.openjdk.org/jdk/pull/14411