Sat, 04 Aug 2018 12:55:17 +0100
Merge
mcimadamore@1415 | 1 | /* |
vromero@2015 | 2 | * @test /nodynamiccopyright/ |
mcimadamore@1415 | 3 | * @bug 8003280 |
mcimadamore@1415 | 4 | * @summary Add lambda tests |
mcimadamore@1415 | 5 | * check that generic method reference is inferred when type parameters are omitted |
vromero@2000 | 6 | * @compile/fail/ref=MethodReference46.out -XDrawDiagnostics MethodReference46.java |
mcimadamore@1415 | 7 | */ |
vromero@2015 | 8 | |
mcimadamore@1415 | 9 | public class MethodReference46 { |
mcimadamore@1415 | 10 | |
mcimadamore@1415 | 11 | interface SAM1 { |
mcimadamore@1415 | 12 | void m(String s); |
mcimadamore@1415 | 13 | } |
mcimadamore@1415 | 14 | |
mcimadamore@1415 | 15 | interface SAM2 { |
mcimadamore@1415 | 16 | void m(Integer s); |
mcimadamore@1415 | 17 | } |
mcimadamore@1415 | 18 | |
mcimadamore@1415 | 19 | interface SAM3 { |
mcimadamore@1415 | 20 | void m(Object o); |
mcimadamore@1415 | 21 | } |
mcimadamore@1415 | 22 | |
mcimadamore@1415 | 23 | static class Foo<X extends Number> { |
mcimadamore@1415 | 24 | Foo(X x) { } |
mcimadamore@1415 | 25 | } |
mcimadamore@1415 | 26 | |
mcimadamore@1415 | 27 | static <X extends Number> void m(X fx) { } |
mcimadamore@1415 | 28 | |
vromero@2000 | 29 | static void g1(SAM1 s) { } |
vromero@2000 | 30 | |
vromero@2000 | 31 | static void g2(SAM2 s) { } |
vromero@2000 | 32 | |
vromero@2000 | 33 | static void g3(SAM3 s) { } |
vromero@2000 | 34 | |
vromero@2000 | 35 | static void g4(SAM1 s) { } |
vromero@2000 | 36 | static void g4(SAM2 s) { } |
vromero@2000 | 37 | static void g4(SAM3 s) { } |
mcimadamore@1415 | 38 | |
mcimadamore@1415 | 39 | public static void main(String[] args) { |
vromero@2000 | 40 | g1(MethodReference46::m); |
vromero@2000 | 41 | g2(MethodReference46::m); |
vromero@2000 | 42 | g3(MethodReference46::m); |
vromero@2000 | 43 | g4(MethodReference46::m); |
mcimadamore@1415 | 44 | } |
mcimadamore@1415 | 45 | } |