No subject

Srikanth srikanth.adayapalam at oracle.com
Tue Jan 19 08:26:38 UTC 2021


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/a18f7613/attachment.htm>


More information about the compiler-dev mailing list