Wed, 27 Apr 2016 01:34:52 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17
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=MethodReference47.out -XDrawDiagnostics MethodReference47.java |
aoqi@0 | 7 | */ |
aoqi@0 | 8 | public class MethodReference47 { |
aoqi@0 | 9 | |
aoqi@0 | 10 | interface SAM1 { |
aoqi@0 | 11 | void m(Integer s); |
aoqi@0 | 12 | } |
aoqi@0 | 13 | |
aoqi@0 | 14 | interface SAM2 { |
aoqi@0 | 15 | void m(Integer s); |
aoqi@0 | 16 | } |
aoqi@0 | 17 | |
aoqi@0 | 18 | static class Foo<X extends Number> { |
aoqi@0 | 19 | Foo(X x) { } |
aoqi@0 | 20 | } |
aoqi@0 | 21 | |
aoqi@0 | 22 | static <X extends Number> void m(X fx) { } |
aoqi@0 | 23 | |
aoqi@0 | 24 | static void g1(SAM1 s) { } |
aoqi@0 | 25 | static void g2(SAM1 s) { } |
aoqi@0 | 26 | static void g2(SAM2 s) { } |
aoqi@0 | 27 | |
aoqi@0 | 28 | public static void main(String[] args) { |
aoqi@0 | 29 | g1(MethodReference47::m); |
aoqi@0 | 30 | g2(MethodReference47::m); |
aoqi@0 | 31 | } |
aoqi@0 | 32 | } |