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=MostSpecific05.out -XDrawDiagnostics MostSpecific05.java
|
2012-11-17 19:01:03 +00:00
|
|
|
*/
|
|
|
|
public class MostSpecific05 {
|
2012-10-04 12:04:53 +00:00
|
|
|
|
2012-11-17 19:01:03 +00:00
|
|
|
interface ObjectConverter<T extends Object> {
|
|
|
|
T map(Object o);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface NumberConverter<T extends Number> {
|
|
|
|
T map(Object o);
|
|
|
|
}
|
|
|
|
|
|
|
|
static class MyMapper<A extends Object, B extends Number> {
|
2013-09-02 21:38:36 +00:00
|
|
|
void map(ObjectConverter<? extends A> m) { }
|
|
|
|
void map(NumberConverter<? extends B> 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
|
|
|
MyMapper<Number, Double> mm = new MyMapper<Number, Double>();
|
2013-09-02 21:38:36 +00:00
|
|
|
mm.map(e->1.0); //ambiguous - implicit
|
|
|
|
mm.map((Object e)->1.0); //ok
|
2012-11-17 19:01:03 +00:00
|
|
|
}
|
2012-10-04 12:04:53 +00:00
|
|
|
}
|