Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
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 raw qualifier in unbound method reference is inferred from descriptor |
vromero@2000 | 6 | * @compile/fail/ref=MethodReference48.out -XDrawDiagnostics MethodReference48.java |
mcimadamore@1415 | 7 | */ |
vromero@2015 | 8 | |
mcimadamore@1415 | 9 | public class MethodReference48 { |
mcimadamore@1415 | 10 | |
mcimadamore@1415 | 11 | static class Foo<X> { |
mcimadamore@1415 | 12 | X m() { return null; }; |
mcimadamore@1415 | 13 | } |
mcimadamore@1415 | 14 | |
mcimadamore@1415 | 15 | interface SAM1 { |
mcimadamore@1415 | 16 | Foo<Object> m(Foo<String> fs); |
mcimadamore@1415 | 17 | } |
mcimadamore@1415 | 18 | |
mcimadamore@1415 | 19 | interface SAM2 { |
mcimadamore@1415 | 20 | Integer m(Foo<Integer> fi); |
mcimadamore@1415 | 21 | } |
mcimadamore@1415 | 22 | |
mcimadamore@1415 | 23 | interface SAM3 { |
mcimadamore@1415 | 24 | Object m(Foo<Integer> fi); |
mcimadamore@1415 | 25 | } |
mcimadamore@1415 | 26 | |
vromero@2000 | 27 | static void g1(SAM1 s) { } //return type not compatible |
vromero@2000 | 28 | |
vromero@2000 | 29 | static void g2(SAM2 s) { } //ok |
vromero@2000 | 30 | |
vromero@2000 | 31 | static void g3(SAM3 s) { } //ok |
vromero@2000 | 32 | |
vromero@2000 | 33 | static void g4(SAM1 s) { } //return type not compatible |
vromero@2000 | 34 | static void g4(SAM2 s) { } //ok |
vromero@2000 | 35 | static void g4(SAM3 s) { } //ok |
mcimadamore@1415 | 36 | |
mcimadamore@1415 | 37 | public static void main(String[] args) { |
vromero@2000 | 38 | g1(Foo::m); |
vromero@2000 | 39 | g2(Foo::m); |
vromero@2000 | 40 | g3(Foo::m); |
vromero@2000 | 41 | g4(Foo::m); |
mcimadamore@1415 | 42 | } |
mcimadamore@1415 | 43 | } |