Re: Compiler bug? "reference to addAll is ambiguous"
"Roedy Green" <see_website@mindprod.com.invalid> wrote in message
news:c4bi9318pn2u9u0pd5lq7tbqd705kb58af@4ax.com...
On Fri, 13 Jul 2007 11:26:37 -0400, "Oliver Wong"
<owong@castortech.com> wrote, quoted or indirectly quoted someone who
said :
Rewriting\src\java\gov\sc\eip\report\birt\ChangesRowGenerator.java:116:
reference to addAll is ambiguous, both method
addAll(java.util.Collection<? extends E>) in
java.util.Collection<capture#420 of ? super
gov.sc.eip.report.birt.items.ChangeRow> and method
addAll(java.util.Collection<? extends E>) in java.util.List<capture#420
of
? super gov.sc.eip.report.birt.items.ChangeRow> match
</errorMessage>
This sort of problem happens when you use java.util.List and
java.awt.List in the same program. You have to fully qualify each
reference with package name to avoid ambiguity.
However, your case is more peculiar.
Right, there's no reference to java.awt.* at all: It's a web
application, not a desktop one.
It looks as if are doing x.addall(
where x is both a Collection and a List.
Yet this should not cause trouble. List is a subinterface of
Collection.
Agreed.
The practical way out of this is to define x concretely, e.g.
ArrayList<Thing> x = new ArrayList<Thing>( 2000);
x.addAll (myThingCollection);
Please post code, at least your imports, where you define x, where
you define the collection and the type of the collection and the
addall. This is intriguing.
We (the company I work for) actually don't fully own the code. It's
shared among a couple of developers working for several different
companies all collaborating on one big project, so I'm not sure I can post
the full code. Furthermore, since I can't actually replicate the problem
on my machine, I can't really compose an SSCCE, because I can't test
whether the parts which I consider "unimportant" actually affect the bug
or not: No matter what I add or remove, the code compiles fine on *my*
machine.
- Oliver