hg: lambda/lambda/langtools: Improved support for diagnostic during lambda conversion.
maurizio.cimadamore at oracle.com
maurizio.cimadamore at oracle.com
Tue Jun 22 09:22:18 PDT 2010
Changeset: 1cbf9ca0c589
Author: mcimadamore
Date: 2010-06-22 17:19 +0100
URL: http://hg.openjdk.java.net/lambda/lambda/langtools/rev/1cbf9ca0c589
Improved support for diagnostic during lambda conversion.
Now the compiler emits more specific info about why a function type cannot be assigned to a SAM type (does not cover method resolution diagnostics).
Examples:
TestX.java:16: incompatible types; target method pippo in class I is not suitable for lambda conversion
I f = #(Integer i) { return new Integer(i); };
^
required: I
found: #Integer(Integer)
1 error
Test.java:16: incompatible types; target method pippo in class I is not suitable for lambda conversion
I f = #(Integer i) { return new Integer(i); };
^
required: I
found: #Integer(Integer)
Test.java:16: incompatible types; the target type of a lambda conversion must be an abstract class/interface
I f = #(Integer i) { return new Integer(i); };
^
required: I
found: #Integer(Integer)
Test.java:16: incompatible types; no target method for lambda conversion found in class I
I f = #(Integer i) { return new Integer(i); };
^
required: I
found: #Integer(Integer)
Test.java:16: incompatible types; the target type of a lambda conversion must define a default constructor
I f = #(Integer i) { return new Integer(i); };
^
required: I
found: #Integer(Integer)
! src/share/classes/com/sun/tools/javac/code/Types.java
! src/share/classes/com/sun/tools/javac/comp/Check.java
! src/share/classes/com/sun/tools/javac/resources/compiler.properties
! test/tools/javac/lambda/BadConv01.out
! test/tools/javac/lambda/BadConv02.out
More information about the lambda-dev
mailing list