Lambda and parameterized ref of an inline type doesn't work well
Srikanth
srikanth.adayapalam at oracle.com
Thu May 7 00:10:13 UTC 2020
Thanks for the test case, I have raised
https://bugs.openjdk.java.net/browse/JDK-8244559
(Did you mean to send this to valhalla-dev?)
There are a bunch of rough edges in the evolving implementation when it
comes to generics,
https://github.com/openjdk/valhalla/pull/32 documents a set of known
problems and also has
a handful of snippets that used to compile earlier, but don't now - some
of them involving the
older experimental option -XDallowGenericsOverValues - which is
withdrawn now.
I am in discussions to address these. This is a major churn we are going
through right now.
Thanks for your patience.
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