[lworld] RFR: JDK-8251986: [lworld] implement Class::valueType and Class::referenceType in Java [v2]

Mandy Chung mchung at openjdk.java.net
Wed Aug 19 21:03:32 UTC 2020


On Wed, 19 Aug 2020 19:50:27 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> 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 seven additional commits since
>> the last revision:
>>  - remove debug println statement
>>  - Merge branch 'lworld' of https://github.com/openjdk/valhalla into projection-types
>>  - supports_sealed_types checks only the major version
>>  - remove unused import
>>  - disable preview feature check for sealed types
>>  - Merge branch 'lworld' of https://github.com/openjdk/valhalla into lworld
>>  - implement Class::referenceType and Class::valueType in Java
>
> src/java.base/share/classes/java/lang/Class.java line 650:
> 
>> 649:
>> 650:         return valueProjectionType() != null;
>> 651:     }
> 
> This path computed the valueProjecttionType and then discards it to be computed again on line 631.

I don't think this path is performance critical.  We can look into this if performance turns out to be an issue.

> src/java.base/share/classes/java/lang/Class.java line 661:
> 
>> 660:         if (subclassNames.length == 1) {
>> 661:             String cn = subclassNames[0].replace('/', '.');
>> 662:             int index = cn.lastIndexOf('.');
> 
> String.regionMatches() could be used to compare the substrings without making copies and it should be ok to compare the
> package names without translating '/' to '.'.

getPackageName() returns a "."-separated package name (not the internal form). I will leave it as is.

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

PR: https://git.openjdk.java.net/valhalla/pull/152


More information about the valhalla-dev mailing list