Thu, 20 Mar 2014 10:42:00 -0700
Merge
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 | } |