Refine generic signature for Map.get/remove

Before this change generic signature wasn't written because of wrong
assumption about it absence in all cases where we replace generic parameter
with Object
This commit is contained in:
Denis Zharkov
2015-11-24 17:19:15 +03:00
parent 20cbceb56d
commit 6292833a69
8 changed files with 73 additions and 27 deletions

View File

@@ -0,0 +1,13 @@
import java.util.*;
public class J {
private static class MyMap<K, V> extends KMap<K, V> {}
public static String foo() {
Map<String, Integer> collection = new MyMap<String, Integer>();
if (!collection.containsKey("ABCDE")) return "fail 1";
if (!collection.containsValue(1)) return "fail 2";
return "OK";
}
}