skip errors in case of diamond inference with type parameters on constructor

This commit is contained in:
Anna.Kozlova
2017-04-03 13:52:13 +02:00
parent dbf64509e9
commit faa4c93b47
5 changed files with 44 additions and 7 deletions
@@ -0,0 +1,31 @@
import java.util.Map;
import java.util.function.Consumer;
class MyTest {
static void createClass(Map<String, Object> templateAttributes,
final Consumer<Integer> postProcessRunnable) {
}
void f(Map<String, String> m) {
final Ref<Integer> clazz = new Ref<>();
createClass(
new HashMap<>(foo(m)),
i -> clazz.set(i)
);
}
private Map<String, String> foo(final Map<String, String> m) {
return null;
}
private class Ref<T> {
void set(T t) {
}
}
}
class HashMap<K, V> extends java.util.HashMap<K, V> {
public <K1 extends K, V1 extends V> HashMap(Map<? extends K1, ? extends V1> map) {
super(map);
}
}
@@ -48,7 +48,7 @@ class Test2 {
{
Class c = D.class;
D<String> d = new D<error descr="Cannot infer arguments"><></error>(s -> s.<error descr="Cannot resolve method 'isEmpty()'">isEmpty</error>(), c);
D<String> d = new D<>(s -> s.<error descr="Cannot resolve method 'isEmpty()'">isEmpty</error>(), c);
D<String> d1 = D.create(s -> s.<error descr="Cannot resolve method 'isEmpty()'">isEmpty</error>(), c);
}
}