Hey guys. In a place I have a method with a generic "VT extends String". Obviously this generates a warning: The type parameter VT should not be bounded by the final type String. Final types cannot be further extended. Do you know if there's a way to suppress this warning (Eclipse)? If you're wondering how I got to have this:
import java.util.ArrayList;
import java.util.List;
class A<T> {
T value;
B<? super T> b;
void method() {
b.method(value,new ArrayList<T>());
}}
interface B<X> {
<VT extends X> VT method(VT p, List<VT> lst);
}
// works fine
class C implements B<Number> {
public <VT extends Number> VT method(final VT p, final List<VT> lst) {
return p;
}}
// causes warning
class D implements B<String> {
public <VT extends String> VT method(final VT p, final List<VT> lst) {
return p;
}}
// error: The type E must implement the inherited abstract method B<String>.method(VT, List<VT>)
class E implements B<String> {
@SuppressWarnings("unchecked")
public String method(final String p, final List<String> lst) {
return p;
}}
Thanks! Cristian