Lambda and parameterized ref of an inline type doesn't work well

Srikanth srikanth.adayapalam at oracle.com
Fri May 8 13:00:46 UTC 2020


Hello Remi,

Thanks for the report - this should be fixed by the commit 
https://github.com/openjdk/valhalla/commit/e586cdbe made for
https://bugs.openjdk.java.net/browse/JDK-8244559

With this all three problems reported are solved and should work now.

(The inline + record synthesized methods is open)

Srikanth

On 07/05/20 4:07 am, Remi Forax wrote:
>    @__inline__ static class Foo<V> {
>      int x;
>      Foo(int x) { this.x = x; }
>    }
>
>    static void m(Foo foo) {
>      System.out.println("inline");
>    }
>    static void m(Foo.ref foo) {
>      System.out.println("ref");
>    }
>
>    public static void main(String[] args) {
>      List<Foo.ref<Integer>> list = List.of(new Foo<Integer>(3));
>      list.stream().forEach(e -> m(e));
>    }
>
> I don't even understand the error message when playing with parameterized ref of an inline type.
>
> error: cannot select a static class from a parameterized type
> Hello.java:19: error: incompatible types: incompatible parameter types in lambda expression
>      list.stream().forEach(e -> m(e));
>                            ^
>
> regards,
> Rémi



More information about the amber-dev mailing list