[lworld] RFR: 8273301: [lworld] Bootstrap of instance-capturing lambda fails for reference favoring primitive types.
Jesper Steen Møller
jespersm at openjdk.java.net
Fri Sep 24 09:10:11 UTC 2021
On Fri, 17 Sep 2021 00:12:18 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> Fix the test by adjusting bootstrap parameters, like it was fixed in JDK-8271583.
>
> I discussed with Dan offline to follow up my question in what cases javac should emit `(LFoo;)LR;` vs `(QFoo;)LR;`. For the lambda case, having the receiver type as `QFoo;` is a good thing to do as it's an instance method of the enclosing class.
>
> For a method reference `o::m` where `o` is of primitive reference type, the factory type would be `(LFoo;)LR;`. I have a test case that verifies the emitted code is:
>
> 28: invokedynamic #38, 0 // InvokeDynamic #1:get:(LX;)Ljava/util/function/Supplier;
>
>
> In short, it's good to fix javac to emit `QFoo;` as the receiver type if it's a primitive class.
Based on @mlchung 's comment from last week, it would be correct to integrate this.
-------------
PR: https://git.openjdk.java.net/valhalla/pull/545
More information about the valhalla-dev
mailing list