2012-10-04 12:04:53 +00:00
|
|
|
/*
|
2020-12-30 17:20:54 +00:00
|
|
|
* @test /nodynamiccopyright/
|
2012-11-17 19:01:03 +00:00
|
|
|
* @bug 8003280
|
|
|
|
* @summary Add lambda tests
|
|
|
|
* Structural most specific doesn't handle cases with wildcards in functional interfaces
|
2013-09-02 21:38:36 +00:00
|
|
|
* @compile/fail/ref=MostSpecific04.out -XDrawDiagnostics MostSpecific04.java
|
2012-11-17 19:01:03 +00:00
|
|
|
*/
|
|
|
|
public class MostSpecific04 {
|
2012-10-04 12:04:53 +00:00
|
|
|
|
2012-11-17 19:01:03 +00:00
|
|
|
interface DoubleMapper<T> {
|
|
|
|
double map(T t);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LongMapper<T> {
|
|
|
|
long map(T t);
|
|
|
|
}
|
|
|
|
|
|
|
|
static class MyList<E> {
|
2013-09-02 21:38:36 +00:00
|
|
|
void map(DoubleMapper<? super E> m) { }
|
|
|
|
void map(LongMapper<? super E> m) { }
|
2012-11-17 19:01:03 +00:00
|
|
|
}
|
2012-10-04 12:04:53 +00:00
|
|
|
|
2023-01-17 04:43:40 +00:00
|
|
|
public static void meth() {
|
2012-11-17 19:01:03 +00:00
|
|
|
MyList<String> ls = new MyList<String>();
|
2013-09-02 21:38:36 +00:00
|
|
|
ls.map(e->e.length()); //ambiguous - implicit
|
|
|
|
ls.map((String e)->e.length()); //ok
|
2012-11-17 19:01:03 +00:00
|
|
|
}
|
2012-10-04 12:04:53 +00:00
|
|
|
}
|