问题是这样的:
ArrayList<A> aList = new ArrayList<A>();
ArrayList<B> bList = new ArrayList<B>();
aList = bList; // if this were valid...
aList.add(new A()); // ...what should happen here?
B b = bList.get(0); // ...and here?
如果对数组执行相同的操作,则在运行时会在第4行获得ArrayStoreException。对于泛型集合,已决定在编译时避免这种情况。