Generic Name Clash in one workspace but not other [message #653385] |
Wed, 09 February 2011 10:36  |
Eclipse User |
|
|
|
Hi all,
I have seen many posts in the bug repository regarding type name clashes and it seems some are attributable to the JDK others to Eclipse. I'm not sure which situation my scenario falls into but it does seem that the issue I am encountering may be related to my workspace.
I have a class which extends HashSet which in turn overrides the the addAll(...) method of AbstractCollection. When the project is built in one workspace the compiler reports the following error:
Type Name clash: The method addAll(Collection<SuperContent>) of type ExtendedSet has the same erasure as addAll(Collection<? extends E>) of type AbstractCollection<E> but does not override it.
Another workspace on my machine and those of coworkers using the same source and project settings from our repository do not report this issue. We are using JDK 1.6.0_23 in all workspaces. I am running Helios build 20100917-0705 while my coworker is running Galileo, Version: 3.5.2
Build id: M20100211-1343.
For reference:
SomeContent extends SuperContent
public class ExtendedSet extends HashSet<SomeContent>{
public void addAll( Collection<SuperContent> items ) {
...
}
}
and from the JDK AbstractCollection defines:
public boolean addAll(Collection<? extends E> c) {
...
}
As I understand, after erasure the return type becomes irrelevant. Regardless, I have modified the overidden addAll(...) to return a boolean and I saw no change to the errors being reported.
If the error being reported is valid, that's fine and I can look to correct the issue. My main concern is the inconsistency of the IDE in reporting the issue. It leads me to believe that there may be an issue in the workspace that needs to be resolved.
It may be interesting to note that I was able to compile the project briefly without making changes to anything. After restarting Eclipse(reluctantly, because I was worried this would happen...) , the issue came back.
Anyone have ideas regarding the reason this one workspace would be reporting this issue and how I might be able to get rid of the errors?
Thanks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Generic Name Clash in one workspace but not other [message #654255 is a reply to message #654243] |
Mon, 14 February 2011 14:00  |
Eclipse User |
|
|
|
Yes, that does fix the issue in my environment!
I still have no idea why this builds on other machines but I can't really take those over to fix what is NOT being indicated as broken.
Thank you for being a great second set of eyes and letting me know the right way to declare this class\method.
Pat.
|
|
|
Powered by
FUDForum. Page generated in 0.63987 seconds