What am I doing wrong? hg: lambda/lambda/langtools: More bug fixes:

Howard Lovatt howard.lovatt at gmail.com
Sat Aug 14 04:02:34 PDT 2010


Great work on updating JDK 7.

I have been trying to use the method pointers but I get a what I think
is a bug. I get:


lambdas/Main.java:35: function types are not supported in -source 1.7
    Arrays.sort( people, #Person.compareByAge );
                          ^
  (use -source 7 or higher and -XDallowFunctionTypes to enable function types)
lambdas/Main.java:35: '(' expected
    Arrays.sort( people, #Person.compareByAge );
                                             ^
lambdas/Main.java:35: ')' expected
    Arrays.sort( people, #Person.compareByAge );


My runtime line is:


     $jdk/javac -Xlint:all -source 7 -XDallowFunctionTypes -d
../build/classes $package/*.java


I built javac from the latest hg changeset on a Mac running 10.6.
Therefore javac in the above is the script created by the makefile in
the hg repository. The underling VM is MLVM from
http://www.concord.org/~sbannasch/mlvm/.

If I change to #Person.compareByAge() I get:


    lambdas/Main.java:35: function types are not supported in -source 1.7
    Arrays.sort( people, #Person.compareByAge() );
                          ^
  (use -source 7 or higher and -XDallowFunctionTypes to enable function types)
1 error


If I change to #Person.compareByAge( Person, Person ) I get:


lambdas/Main.java:35: function types are not supported in -source 1.7
    Arrays.sort( people, #Person.compareByAge( Person, Person ) );
                          ^
  (use -source 7 or higher and -XDallowFunctionTypes to enable function types)
1 error


If I change to Person#compareByAge( Person, Person ) I get:


An exception has occurred in the compiler (1.7.0-internal). Please
file a bug at the Java Developer Connection
(http://java.sun.com/webapps/bugreport)  after checking the Bug Parade
for duplicates. Include your program and the following diagnostic in
your report.  Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for
com.sun.runtime.ProxyHelper not found



What am I doing wrong?

  -- Howard.


More information about the lambda-dev mailing list