Non-generic reference to generic class results in non-generic return types

后端 未结 3 651
闹比i
闹比i 2021-01-02 13:31

I have a legacy class that the class itself is not a generic but one of its methods return type uses generics:

public class Thing {
    public Collection<         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-02 13:57

    It is failing because of erasure. You can read more about it in these Java Tutorials

提交回复
热议问题