Part F - Question

Srikanth S Adayapalam srikanth_sankaran at in.ibm.com
Wed Nov 27 20:35:52 PST 2013


> From: Srikanth S Adayapalam/India/IBM
> Subject: Part F - Question
> 
> Hello !
> 
> 1. javac 8b116 refuses to compile this program ("reference to goo is
> ambiguous"):
> Per my reading, the reference compiler is indeed closely following 
> the letter of 
> the specification in this test case:

Actually, I think I am mistaken and this looks like a bug in javac 8b115.
(My earlier mail mistakenly mentioned 8b116 - I tested only with 8b115)
Per 15.12.2.1, goo(J) is not a potentially applicable method to the method
invocation given J's function type requires a void return and the argument
lambda expression is not void compatible.

Dan &| Maurizio, could you confirm this is a bug in the RI or if I have 
overlooked something ?

Thanks!
Srikanth

 
 // --
 interface I {
  String foo(String [] x, String y);
 }
 interface J {
  void foo(int x, int y);
 }
 public class X {
     static void goo(J j) {
         System.out.println("goo(J)");
     }
     static void goo(I i) {
         System.out.println("goo(I)");
     }
     public static void main(String[] args) throws InterruptedException {
        goo((x, y) -> { return x[0] += 1; });
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-spec-experts/attachments/20131128/508cb5a8/attachment.html 


More information about the lambda-spec-experts mailing list