Community
Participate
Working Groups
I20050426-1700 Eclipse accepts this: { Vector< ? super java.lang.Object[] > lhs= null; Vector< ? extends java.lang.Object[] > rhs= null; lhs.add(rhs.get(0)); } javac says: C:\e\workspace\zz1.5\src\xy\Try.java:30: cannot find symbol symbol : method add(java.lang.Object[]) location: class java.util.Vector<capture of ? super java.lang.Object[]> lhs.add(rhs.get(0)); ^
Added GenericTypeTest#test632-633. Tuned compatibility check against array bounded captures. Fixed
Fixed
Philippe, are you sure this is not a javac bug? lhs must be one of: Vector<Object[]> | Vector<Object> | Vector<Serializable> | Vector<Cloneable>. rhs can be: Vector<Object[]> | Vector<Number[]> | Vector<String[]> | etc. ... Can't I take any object that I can get from a rhs Vector and put it into any one of the lhs Vectors? I can't find a relevant difference to the following snippet, which both compilers accept: Vector< ? super Number> lhsNum= null; Vector< ? extends Number > rhsNum= null; lhsNum.add(rhsNum.get(0));
Verified in I20050510-0010
Actually, I20050426-1700 was correct and this is a bug in javac: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6268476
I saw it, and there are other situations which are unclear. Waiting on spec clarification.
Eclipse accepts the example from comment 0 again (fixed in bug 106865).