RFR: JDK-8209407: VerifyError is thrown for inner class with lambda

Vicente Romero vicente.romero at oracle.com
Fri Oct 5 18:18:20 UTC 2018

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.


[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/20181005/a7c7726b/attachment.html>

More information about the compiler-dev mailing list