test/tools/javac/lambda/MethodReference41.java

Wed, 14 May 2014 15:41:28 -0600

author
dlsmith
date
Wed, 14 May 2014 15:41:28 -0600
changeset 2395
9c577131ffa6
parent 2015
a4b9a8859e58
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8034223: Most-specific should not have any special treatment for boxed vs. unboxed types
Summary: Rewrite most-specific logic to conform to JLS 8 15.12.2.5
Reviewed-by: vromero

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 diamond inference is applied when using raw constructor reference qualifier
vromero@2000 6 * @compile/fail/ref=MethodReference41.out -XDrawDiagnostics MethodReference41.java
mcimadamore@1415 7 */
vromero@2015 8
mcimadamore@1415 9 public class MethodReference41 {
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
vromero@2000 27 static void m1(SAM1 s) { }
mcimadamore@1415 28
vromero@2000 29 static void m2(SAM2 s) { }
vromero@2000 30
vromero@2000 31 static void m3(SAM3 s) { }
vromero@2000 32
vromero@2000 33 static void m4(SAM1 s) { }
vromero@2000 34 static void m4(SAM2 s) { }
vromero@2000 35 static void m4(SAM3 s) { }
mcimadamore@1415 36
mcimadamore@1415 37 public static void main(String[] args) {
vromero@2000 38 m1(Foo::new);
vromero@2000 39 m2(Foo::new);
vromero@2000 40 m3(Foo::new);
vromero@2000 41 m4(Foo::new);
mcimadamore@1415 42 }
mcimadamore@1415 43 }

mercurial