Class is a raw type. References to generic type Class should be parameterized

前端 未结 2 952
不思量自难忘°
不思量自难忘° 2020-11-28 11:52

I have the following class (from a simple Spring tutorial)

public class CarValidator implements Validator {

    public boolean supports(Class aClass) {
             


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 12:28

    Since the interface forces you to use the raw type (i.e. doesn't allow you to specify the correct type information) you can't implement it without warnings unless you use @SupressWarnings.

    The only real fix is to fix the interface (i.e. make it define boolean supports(Class aClass)).

提交回复
热议问题