test/tools/javac/lambda/MethodReference45.java

Thu, 21 Feb 2013 15:27:05 +0000

author
mcimadamore
date
Thu, 21 Feb 2013 15:27:05 +0000
changeset 1600
3fef0cae83b3
parent 0
959103a6100f
permissions
-rw-r--r--

8008444: Inherited generic functional descriptors are merged incorrectly
Summary: Missing call to Types.createMethodWithThrownTypes
Reviewed-by: jjg

aoqi@0 1 /*
aoqi@0 2 * @test /nodynamiccopyright/
aoqi@0 3 * @bug 8003280
aoqi@0 4 * @summary Add lambda tests
aoqi@0 5 * check that generic method reference is inferred when type parameters are omitted
aoqi@0 6 * @compile/fail/ref=MethodReference45.out -XDrawDiagnostics MethodReference45.java
aoqi@0 7 */
aoqi@0 8 public class MethodReference45 {
aoqi@0 9
aoqi@0 10 static int assertionCount = 0;
aoqi@0 11
aoqi@0 12 static void assertTrue(boolean cond) {
aoqi@0 13 assertionCount++;
aoqi@0 14 if (!cond)
aoqi@0 15 throw new AssertionError();
aoqi@0 16 }
aoqi@0 17
aoqi@0 18 static class SuperFoo<X> { }
aoqi@0 19
aoqi@0 20 static class Foo<X extends Number> extends SuperFoo<X> { }
aoqi@0 21
aoqi@0 22 interface SAM1 {
aoqi@0 23 void m();
aoqi@0 24 }
aoqi@0 25
aoqi@0 26 interface SAM2 {
aoqi@0 27 void m();
aoqi@0 28 }
aoqi@0 29
aoqi@0 30 static <X extends Number> Foo<X> m() { return null; }
aoqi@0 31
aoqi@0 32 static void g1(SAM1 s) { }
aoqi@0 33 static void g2(SAM1 s) { }
aoqi@0 34 static void g2(SAM2 s) { }
aoqi@0 35
aoqi@0 36 void test() {
aoqi@0 37 g1(MethodReference45::m);
aoqi@0 38 g2(MethodReference45::m);
aoqi@0 39 }
aoqi@0 40 }

mercurial