Hi
I'm new to this forum. HOpe this question wasn't ask before. When searching the forums I didn't find an asnswer for my problem... My question is, what's wrong with this code:
Vector<-Integer> v = new Vector<Number>();
Integer in = new Integer(5);
v.add(in);
My compiler says
javac15 -warnunchecked CotV1.java
CotV1.java:10: reference to add is ambiguous, both method add(E) in java.util.AbstractCollection<=-java.lang.Integer> and method add(E) in java.util.AbstractList<=-java.lang.Integer> match
v.add(in);
^
1 error
My java environemnt is Windows 2000 SP4 German
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
if Neal or Christian don't respond here within a day or two, please report this to mailto:jsr14-prototype-comments@sun.com
Its the old invalid assumption bug, where the invalid assumption is that your code is wrong when in fact its a system bug - the trouble with these is that they chew up heaps of effort before you convince yourself that you are doing everything right, and therefore the compiler or whatever is faulty. Note, with these beta's you should drop the assumption that the compiler is always right. Its only nearly always right. :)
This is a known bug. It's listed at
http://cag.lcs.mit.edu/~cananian/Projects/GJ/
as Sun bug 4872698
http://developer.java.sun.com/developer/bugParade/bugs/4872698.html
which I believe was first reported here:
http://forum.java.sun.com/thread.jsp?forum=316&thread=406516