<i18n dev> RFR: 8342865: Use type parameter for Class::getPrimitiveClass [v2]
Chen Liang
liach at openjdk.org
Thu Oct 24 03:14:47 UTC 2024
On Wed, 23 Oct 2024 23:56:33 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> 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 four additional commits since the last revision:
>>
>> - Comment about the type parameter
>> - Merge branch 'master' of https://github.com/openjdk/jdk into cleanup/class-getprimitiveclass
>> - Merge branch 'master' of https://github.com/openjdk/jdk into cleanup/class-getprimitiveclass
>> - 8342865: Use type parameter for Class::getPrimitiveClass
>
> src/java.base/share/classes/java/lang/Class.java line 3284:
>
>> 3282: * primitive type.
>> 3283: */
>> 3284: static native <T> Class<T> getPrimitiveClass(String name);
>
> I checked the code in java.base and this method is only called by the wrapper classes (and void), as expected.
>
> I think the refactoring is good, but would like to see a comment here along the lines of "Use of type variable is acceptable since only used within java.lang," etc.
Done. I added a comment "Type parameter T avoids redundant casts for trusted code." and removed "Virtual Machine's" as all Class objects are created by the JVM.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21653#discussion_r1814177633
More information about the i18n-dev
mailing list