On Wed, 21 Jun 2023 22:02:16 GMT, Mandy Chung <[email protected]> wrote:
>> This PR clarifies the spec of the 3-arg Class::forName regarding the format >> of the name for an array type which is of the form: one or more of "[" + >> binary name of the element type + ";'. > > Mandy Chung 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 eight additional > commits since the last revision: > > - improve the specification of forName > - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8310242 > - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8310242 > - Review comment. Add a test > - missing 'L' for the array class name > - review comment > - Clarify for an array class of primitive type > - 8310242: Clarify the name parameter to Class::forName src/java.base/share/classes/java/lang/Class.java line 438: > 436: * representing primitive types or void, hidden classes or > interfaces, > 437: * or array classes whose element type is a hidden class or > interface. > 438: * If {@code name} denotes a primitive type or void, for example > {@code I}, I think `{@code int}` would be a better example here as Java programmers aren't in touch with bytecode descriptors mostly. src/java.base/share/classes/java/lang/Class.java line 459: > 457: * from {@code forName(}<i>N</i>{@code )} returns <i>N</i>. > 458: * > 459: * <p> A call to {@code forName("[L}<i>N</i>{@code ;")} causes the > element type This appears true for multi-dimensional arrays as well, but the name format here only applies to single-dimension arrays. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14528#discussion_r1237808121 PR Review Comment: https://git.openjdk.org/jdk/pull/14528#discussion_r1237809409
