Using eclipse 4.2 with Java 7 and trying to implement the following method of the List interface i got a warning.
public <T> T[] toArray(T[] a) {
return a;
}
The warning says :
The type parameter T is hiding the type T
Why ? How can i get rid of it ?
The List interface is also generic. Make sure that you are not also using T for the generic type in your class. Note that in http://docs.oracle.com/javase/6/docs/api/java/util/List.html, they use "E" for the class generic parameter and "T" for the toArray() generic parameter. This prevents the overlap.
}
Another option is that you have an import of a class called "T" and that's why you are getting the warning. I have just solved my problem after finding out that i had an useless import to:
tl;dr: Check your imports!