RFR: JDK-8209407: VerifyError is thrown for inner class with lambda
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Oct 8 13:09:34 UTC 2018
Looks good.
Maurizio
On 05/10/18 19:18, Vicente Romero wrote:
> Please review the fix for [1] at [2]. javac was compiling a code not
> acceptable to the verifier. This code exemplifies the issue:
>
> import java.util.function.Supplier;
>
> public class Test {
> public static void main(String[] args) {
> Object a = new Object();
> class Local {
> Object ref = a;
> }
> new Object() {
> void unused() {
> Supplier<Local> s = () -> new Local();
> }
> };
> }
> }
>
> here the local class Local is capturing variable `a`, the thing is
> that after LTM processes the lambda, it defines a mapping for that
> free variable. But once the compiler is at Lower, another mapping, a
> proxy variable, is defined. These two mappings collide inside the
> translation of the lambda method and the one defined in LTM should
> trump. This is what this patch is doing.
>
> Thanks,
> Vicente
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8209407
> [2] http://cr.openjdk.java.net/~vromero/8209407/webrev.00/jdk.dev.patch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20181008/2fef605b/attachment.html>
More information about the compiler-dev
mailing list