Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Name Clash: Method in Two Classes Have Same Erasure, Yet Neither Over-..."

843793Jun 4 2008 — edited Jun 11 2008
Ok, I'm getting this message when trying to compile the classes below: "FileUtils.java:1117: name clash: add(E) in java.util.ArrayList<java.util.LinkedList<F>> and add(T) in gov.sandia.gajanik.util.Addable<F> have the same erasure, yet neither overrides the other"

The funny thing is, they actually don't have the same erasure, from what I can see. In short, I have a class
class DuplicatesArrayList<F extends File> extends ArrayList<LinkedList<F>> implements Addable<F>
Addable<T> has a method
public boolean add(T addMe);
and, from the javadoc for jdk1.6.0, ArrayList<E>has a method
public boolean add(E e);
But, note how ArrayList has the type parameter LinkedList<F> and Addable has the type parameter F. Given that, the erasures should be
public boolean add(LinkedList e);//Erasure of LinkedList<F>
public boolean add(File addMe);  //Erasure of F
Am I missing something? Is it just the end of the day and my brain isn't working right? Help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 9 2008
Added on Jun 4 2008
12 comments
5,989 views