For example, lets say you have two classes:
public class TestA {}
public class TestB extends TestA{}
I have a method that returns a L
The problem is that your method does NOT return a list of TestA if it contains a TestB, so what if it was correctly typed? Then this cast:
class TestA{};
class TestB extends TestA{};
List extends TestA> listA;
List listB = (List) listA;
works about as well as you could hope for (Eclipse warns you of an unchecked cast which is exactly what you are doing, so meh). So can you use this to solve your problem? Actually you can because of this:
List badlist = null; // Actually contains TestBs, as specified
List extends TestA> talist = badlist; // Umm, works
List tblist = (List)talist; // TADA!
Exactly what you asked for, right? or to be really exact:
List tblist = (List)(List extends TestA>) badlist;
seems to compile just fine for me.