Duplicate :
|
|
Relates :
|
This should cause a warning. class Pair<X,Y> {} class ObjectPair extends Pair<Object,Object> {} class Test<X,Y>{ public Pair<X,Y> m() { return (Pair<X,Y>)new ObjectPair(); // warning missing here } public static void main(String[] args) { Test<String,String> t = new Test<String,String>(); Pair<String,String> pss = t.m(); } }