test/tools/javac/lambda/MostSpecific08.java

changeset 2000
4a6acc42c3a1
parent 1609
332f23993353
child 2525
2eb010b6cb22
     1.1 --- a/test/tools/javac/lambda/MostSpecific08.java	Fri Aug 30 17:36:47 2013 -0700
     1.2 +++ b/test/tools/javac/lambda/MostSpecific08.java	Mon Sep 02 22:38:36 2013 +0100
     1.3 @@ -25,7 +25,7 @@
     1.4   * @test
     1.5   * @bug 8008813
     1.6   * @summary Structural most specific fails when method reference is passed to overloaded method
     1.7 - * @compile MostSpecific08.java
     1.8 + * @compile/fail/ref=MostSpecific08.out -XDrawDiagnostics MostSpecific08.java
     1.9   */
    1.10  class MostSpecific08 {
    1.11  
    1.12 @@ -51,12 +51,14 @@
    1.13      }
    1.14  
    1.15      void testMref(Tester t) {
    1.16 -        IntResult pr = t.apply(C::getInt);
    1.17 -        ReferenceResult<Integer> rr = t.apply(C::getInteger);
    1.18 +        IntResult pr = t.apply(C::getInt); //ok - unoverloaded mref
    1.19 +        ReferenceResult<Integer> rr = t.apply(C::getInteger); //ok - unoverloaded mref
    1.20      }
    1.21  
    1.22      void testLambda(Tester t) {
    1.23 -        IntResult pr = t.apply(c->c.getInt());
    1.24 -        ReferenceResult<Integer> rr = t.apply(c->c.getInteger());
    1.25 +        IntResult pr1 = t.apply(c->c.getInt()); //ambiguous - implicit
    1.26 +        IntResult pr2 = t.apply((C c)->c.getInt()); //ok
    1.27 +        ReferenceResult<Integer> rr1 = t.apply(c->c.getInteger()); //ambiguous - implicit
    1.28 +        ReferenceResult<Integer> rr2 = t.apply((C c)->c.getInteger()); //ok
    1.29      }
    1.30  }

mercurial