I encounter a problem using a generic method
Compiled class:
public class Something<T> { public static Something newInstance(Class<T> type){}; public <T> void doSomething(T input){}; }
and my method:
public <S> void doOtherThing(S input){ Something smt = Something.newInstance(input.getClass()); smt.doSomething(input);
An error occurred at compile time:
there is no suitable method for doSomething (T) T cannot be converted to capture # 1 from? extends java.lang.Object ...
I think there might be a trick to avoid this, please help
java generics
lethanh
source share