2012-10-04 12:04:53 +00:00
|
|
|
/*
|
2013-09-09 15:32:08 +00:00
|
|
|
* @test /nodynamiccopyright/
|
2012-11-17 19:01:03 +00:00
|
|
|
* @bug 8003280
|
|
|
|
* @summary Add lambda tests
|
|
|
|
* check that diamond inference is applied when using raw constructor reference qualifier
|
2013-09-02 21:38:36 +00:00
|
|
|
* @compile/fail/ref=MethodReference42.out -XDrawDiagnostics MethodReference42.java
|
2012-11-17 19:01:03 +00:00
|
|
|
*/
|
2013-09-09 15:32:08 +00:00
|
|
|
|
2012-11-17 19:01:03 +00:00
|
|
|
public class MethodReference42 {
|
2012-10-04 12:04:53 +00:00
|
|
|
|
2012-11-17 19:01:03 +00:00
|
|
|
static class SuperFoo<X> { }
|
|
|
|
|
|
|
|
static class Foo<X extends Number> extends SuperFoo<X> { }
|
|
|
|
|
|
|
|
interface SAM1 {
|
|
|
|
SuperFoo<String> m();
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SAM2 {
|
|
|
|
SuperFoo<Integer> m();
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SAM3 {
|
|
|
|
SuperFoo<Object> m();
|
|
|
|
}
|
|
|
|
|
2013-09-02 21:38:36 +00:00
|
|
|
static void m1(SAM1 s) { }
|
|
|
|
|
|
|
|
static void m2(SAM2 s) { }
|
|
|
|
|
|
|
|
static void m3(SAM3 s) { }
|
|
|
|
|
|
|
|
static void m4(SAM1 s) { }
|
|
|
|
static void m4(SAM2 s) { }
|
|
|
|
static void m4(SAM3 s) { }
|
2012-10-04 12:04:53 +00:00
|
|
|
|
2023-01-17 04:43:40 +00:00
|
|
|
public static void meth() {
|
2013-09-02 21:38:36 +00:00
|
|
|
m1(Foo::new);
|
|
|
|
m2(Foo::new);
|
|
|
|
m3(Foo::new);
|
|
|
|
m4(Foo::new);
|
2012-11-17 19:01:03 +00:00
|
|
|
}
|
2012-10-04 12:04:53 +00:00
|
|
|
}
|