RFR: 8309819: Fix specification about descriptor inverses in Class and MethodTypeDesc

Chen Liang liach at openjdk.org
Mon Jun 12 08:07:15 UTC 2023


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/00/java.base/java/lang/Class.html
https://cr.openjdk.org/~liach/8309819/00/java.base/java/lang/invoke/MethodType.html

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

Commit messages:
 - 8309819: Fix specification about descriptor inverses in Class and MethodTypeDesc

Changes: https://git.openjdk.org/jdk/pull/14411/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14411&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8309819
  Stats: 27 lines in 2 files changed: 10 ins; 3 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/14411.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14411/head:pull/14411

PR: https://git.openjdk.org/jdk/pull/14411


More information about the core-libs-dev mailing list