hg: lambda/lambda/langtools: Improved support for diagnostic during lambda conversion.
Paul Benedict
pbenedict at apache.org
Tue Jun 22 09:37:16 PDT 2010
Maurizio,
I have a question about this message:
"the target type of a lambda conversion must define a default constructor"
I remember -- yonder in my Sun Certification exam -- the difference
between a default constructor and a public no-arg constructor. The
default constructor is compiler generated and gets the same scope as
the class is defined. Is this what you meant? Or did you mean a public
no-arg constructor? I am referring back to a discussion between you
and Neal.
Paul
On Tue, Jun 22, 2010 at 11:22 AM, <maurizio.cimadamore at oracle.com> wrote:
> 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