RFR: 8306697: Add method to obtain String for CONSTANT_Class_info in ClassDesc [v2]

Chen Liang liach at openjdk.org
Sun Apr 23 16:33:43 UTC 2023


On Sun, 23 Apr 2023 13:13:55 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Unify ofInternalName and internalName, document about CONSTANT_Class_info, remove misleading JVMS 4.4.1 links
>
> src/java.base/share/classes/java/lang/constant/ClassDesc.java line 107:
> 
>> 105:      * @see ClassDesc#internalName()
>> 106:      * @see <a href="#constant-class-info">The {@code CONSTANT_Class_info} Structure</a>
>> 107:      * @since 20
> 
> This should have `@revised`, as array descriptors are not allowed as input to this method in **JDK 20**.
> Suggestion:
> 
>      * @since 20
>      * @revised 21

There's no guideline on using revised. Also, I don't think we will declare it revised if it starts accepting Valhalla Q-types.

> src/java.base/share/classes/java/lang/constant/ClassDesc.java line 375:
> 
>> 373:      * {@code CONSTANT_Class_info}.
>> 374:      *
>> 375:      * @throws IllegalStateException if this {@linkplain ClassDesc} describes a type
> 
> This should really throw `UnsupportedOperationException`, as the instances are immutable, same as [`Class::arrayType()`]. See [JDK‑8268250] and [GH‑4382] for discussion.
> 
> [`Class::arrayType()`]: https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Class.html#arrayType()
> [JDK‑8268250]: https://bugs.openjdk.org/browse/JDK-8268250
> [GH‑4382]: https://github.com/openjdk/jdk/pull/4382

The choice is based on ClassDesc.nested

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13598#discussion_r1174609313
PR Review Comment: https://git.openjdk.org/jdk/pull/13598#discussion_r1174609117


More information about the core-libs-dev mailing list