Community
Participate
Working Groups
Hi I have following class declared: package test; import java.util.ArrayList; import java.util.List; public class Test { public static <T extends Comparable<? super T>> List<T> getList(T clazz) { List<String> toReturn = new ArrayList<>(); return (List<T>) toReturn; } } When added to an Eclipse project it fails to compile with following error on the "return" statement: Cannot cast from List<String> to List<T> There is no quick fix available for the error but the code does not run if launched from Eclipse. The same code compiles fine with plain javac with some warnings though. Best regards Vasil
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Can recreate on : I20210707-1800