No subject

Anna Kozlova anna.kozlova at jetbrains.com
Tue Jan 19 11:38:01 UTC 2021


Thanks!

On Tue, Jan 19, 2021 at 9:27 AM Srikanth <srikanth.adayapalam at oracle.com>
wrote:

> Thanks Anna, I have added this test case to JDK-8259960, if it proves
> necessary  I'll split it later into an issue of its own.
>
> Srikanth
>
> On 18/01/21 4:36 pm, Anna Kozlova wrote:
>
> 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/20210119/6bf08d96/attachment-0001.htm>


More information about the compiler-dev mailing list