RFR: JDK-8274848: LambdaMetaFactory::metafactory on REF_invokeSpecial impl method has incorrect behavior [v2]
Dan Smith
dlsmith at openjdk.java.net
Mon Oct 25 21:42:39 UTC 2021
On Tue, 12 Oct 2021 16:21:33 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> Classes compiled prior to the nestmate support will generate `REF_invokeSpecial` if the implementation method is a private instance method. Since a lambda proxy class is a hidden class, a nestmate of the host class, it can invoke the private implementation method but it has to use `REF_invokeVirtual` or `REF_invokeInterface`. In order to support the old classes running on the new runtime, LMF implementation adjusts the reference kind from `REF_invokeSpecial` to `REF_invokeVirtual/REF_invokeInterface`.
>>
>> This PR fixes the check properly to ensure the adjustment is only made if the implementation method is private method in the host class.
>
> Mandy Chung has updated the pull request incrementally with one additional commit since the last revision:
>
> remove filelist which was added accidentally
Source changes look good.
The test seems like way too much overhead for this small thing. Looks like a lot of the ASM code is just to verify that javac generates the test case you expect? I'd suggest invoking the LMF API directly instead, testing both private and non-private `invokespecial` MethodHandles, just making sure the rules can be used without error.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5901
More information about the core-libs-dev
mailing list