Function type method reference parsing error

Mark Mahieu mark at twistedbanana.demon.co.uk
Mon May 19 06:03:46 PDT 2008


I came across this one in the wreckage of a late-night copy/pasting  
accident:


public class ParseError {

     public static void main(String[] args) {

         Object o;
         o = {=>void}#invoke();          // ok
         o = {int=>void}#invoke(int);    // fails to compile
     }
}


ParseError.java:7: illegal start of expression
         o = {int=>void}#invoke(int);    // fails to compile
                 ^
ParseError.java:7: ';' expected
         o = {int=>void}#invoke(int);    // fails to compile
                       ^
ParseError.java:7: illegal start of type
         o = {int=>void}#invoke(int);    // fails to compile
                        ^
ParseError.java:7: ';' expected
         o = {int=>void}#invoke(int);    // fails to compile
                         ^
ParseError.java:7: illegal start of type
         o = {int=>void}#invoke(int);    // fails to compile
                               ^
ParseError.java:7: <identifier> expected
         o = {int=>void}#invoke(int);    // fails to compile
                                ^
ParseError.java:7: ';' expected
         o = {int=>void}#invoke(int);    // fails to compile
                                   ^
ParseError.java:9: class, interface, or enum expected
}
^
8 errors


Regards,

Mark



More information about the closures-dev mailing list