Eta expansion and unrestricted wildcard

tronicek at fel.cvut.cz tronicek at fel.cvut.cz
Sat May 17 05:12:26 PDT 2008


Hi,

unrestricted wildcard in a method reference does not compile:

     interface Saveable<T> {
         void saveAll();
         void save(T t);
         T restore();
     }

     public static void main(String[] args) throws Exception {
         // this is ok
         { Saveable<String> => void } p1 = { Saveable<?> s => s.saveAll(); };
         // this does not compile
         //{ Saveable<String> => void } p2 = Saveable<?>#saveAll();
     }


Z.
-- 
Zdenek Tronicek
Department of Computer Science and Engineering
Prague                   tel: +420 2 2435 7410
http://cs.felk.cvut.cz/~tronicek









More information about the closures-dev mailing list