I want to override a method that has an parameter of type Object
:
public void setValue(Object value) {
// ...
}
and make that parameter to have a generic type T
:
@Override
public void setValue(T value) {
super.setValue(value);
}
How can I do this in Java?
In Eclipse I get these errors:
Multiple markers at this line
- The type parameter T is hiding the type T
- Name clash: The method setValue(T) of type TextField<T> has the
same erasure as setValue(Object) of type JFormattedTextField but does not
override it
- The method setValue(T) of type TextField<T> must override or
implement a supertype method