I\'m experimenting with generics in Java, and thought of this example.
If I have ClassA, I can override it with a subclass that references a co
In short, the the answer is no. If you define a method with a generic parameter, then its signature contains a the generic and any "overrides" would have to match the signature (contain a generic).
Anyhow, this really is a poor use of generics, as what you've written is semantically the same as
public void doSomething(Object data) {}
The generic bit doesn't buy you much unless is it being used to indicate what the return value would be, as in:
public T doSomething(T data) {}
But why bother? Is there really an issue calling doSomething() generically?