test/tools/javac/lambda/BadMethodCall2.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/BadMethodCall2.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,13 @@
     1.4 +/**
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8004099
     1.7 + * @summary Bad compiler diagnostic generated when poly expression is passed to non-existent method
     1.8 + * @compile/fail/ref=BadMethodCall2.out -XDrawDiagnostics BadMethodCall2.java
     1.9 + */
    1.10 +class BadMethodCall2 {
    1.11 +     void test(Object rec) {
    1.12 +         rec.nonExistent(System.out::println);
    1.13 +         rec.nonExistent(()->{});
    1.14 +         rec.nonExistent(true ? "1" : "2");
    1.15 +     }
    1.16 +}

mercurial