No subject

Anna Kozlova anna.kozlova at jetbrains.com
Mon Jan 18 11:06:33 UTC 2021


Hi all,

the following code doesn't compile with java 12 + (including java 17) with
"cannot find symbolsymbol: variable p"

```

class Boo {
    {
        create(p -> new ArrayList<>() {
            @Override
            public int size() {
                System.out.println(p);
                return super.size();
            }
        });
    }

    private <C> void create(Function<String, ArrayList<String>> o) { }

}

```

though if I replace diamond with explicit type the lambda parameter can be
found in the anonymous class body.

If I remove unused type parameter `C` from `create`, code compiles fine
again.

Looks like a bug to me, could someone please check?

Thanks,
Anna

P.S. java 11 fails with internal compiler error
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20210118/967d949c/attachment.htm>


More information about the compiler-dev mailing list