Type Inference is Causing Verification Error

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Sep 6 02:38:47 PDT 2010


With the latest version of the compiler I'm getting this error when I 
try to compile your code:

/home/maurizio/Desktop/Inference.java:21: incompatible types
                    #(key, olset){new Pair<Integer, Integer>(key, 7)});
                                  ^
   required: Integer
   found:    Pair<Integer,Integer>
1 error

This seems to suggest that the compiler is now correctly rejecting your 
example - is it possible that you are using an old version of the lambda 
compiler?

Maurizio

On 04/09/10 01:42, Ming-Yee Iu wrote:
> public static DBSet2<String>  dummyReturn()
>    {
>      return null;
>    }
>    public static void main(String [] args)
>    {
>      DBSet2<Pair<Integer, Integer>>  matches =
>      dummyReturn()
>        .group(#(ol) {return 5;},
>                     #(key, olset){new Pair<Integer, Integer>(key, 7)}
>                    );
>    }
> }
>
>    



More information about the lambda-dev mailing list