Given:
public void methodOne() {
List<RuntimeException> list = new ArrayList<RuntimeException>();
methodTwo(list);
}
public void methodTwo(List<? extends Exception> list) {
}
Is there any way to check the actual type of the list in methodTwo at run-time? I know there is similar question Get generic type of java.util.List however my question is specifically about wildcards.
Please note that the collection might be empty so checking the elements might not work.