[lworld] RFR: 8244231: [lworld] Add support for ref-default and val-default inline classes.

Srikanth Adayapalam sadayapalam at openjdk.java.net
Thu Jul 22 08:04:04 UTC 2021


On Wed, 21 Jul 2021 13:11:46 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Code changes and tests
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java line 1366:
> 
>> 1364:             if (tsym != null) {
>> 1365:                 if (flavor == Flavor.L_TypeOf_X || tsym.isCompleted()) {
>> 1366:                     flavor = flavor.metamorphose(tsym.flags());
> 
> (Not related to this review) I think we should probably change the `metamorphose` name to a more neutral one like `update` ?

Oh, you didn't like the cute name I coined! I really liked metamorphose() since it captures that the Type starts out in larval form where not much is known about and evolves into a full blown form in stages through metamorphosis!

No matter, I am not wedded to the name,  I will add a note to JDK-8268734 to follow up

> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1215:
> 
>> 1213:                 return sup.tsym == s.tsym
>> 1214:                     && (t.tsym != s.tsym ||
>> 1215:                         (t.isReferenceProjection() == s.isReferenceProjection() && t.isValueProjection() == s.isValueProjection()))
> 
> I guess this works because `asSuper` will return either:
> 
> * a supertype of `t`, in which case we now it's a reference type, so for `t` to be subtype of `s`, it must be that `t` is a reference type too
> * it returns `t` itself, in which case subtyping holds as long as `t` and `s` are the same

Right.

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

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



More information about the valhalla-dev mailing list