2012-10-04 12:04:53 +00:00
|
|
|
/*
|
2013-09-09 15:32:08 +00:00
|
|
|
* @test /nodynamiccopyright/
|
2015-04-22 16:44:15 +00:00
|
|
|
* @bug 8003280 8078024
|
2012-11-17 19:01:03 +00:00
|
|
|
* @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=MethodReference41.out -XDrawDiagnostics MethodReference41.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 MethodReference41 {
|
2012-10-04 12:04:53 +00:00
|
|
|
|
2012-11-17 19:01:03 +00:00
|
|
|
interface SAM1 {
|
|
|
|
void m(String s);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SAM2 {
|
|
|
|
void m(Integer s);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SAM3 {
|
|
|
|
void m(Object o);
|
|
|
|
}
|
|
|
|
|
|
|
|
static class Foo<X extends Number> {
|
|
|
|
Foo(X x) { }
|
|
|
|
}
|
|
|
|
|
2013-09-02 21:38:36 +00:00
|
|
|
static void m1(SAM1 s) { }
|
|
|
|
|
|
|
|
static void m2(SAM2 s) { }
|
|
|
|
|
|
|
|
static void m3(SAM3 s) { }
|
2012-11-17 19:01:03 +00:00
|
|
|
|
2013-09-02 21:38:36 +00:00
|
|
|
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
|
|
|
}
|