0

New to spring, we have a whole pile of validators that generate java warnings, I was able to hide them using the "@SuppressWarnings" annotation, however what is the proper way to sort this out?

public class SignInValidator implements
        org.springframework.validation.Validator {

    @SuppressWarnings("unchecked")
    public boolean supports(Class clazz) {
        return clazz.equals(SignInCredentials.class);
    }
corydoras
  • 6,800
  • 11
  • 52
  • 58

1 Answers1

2

This SO question explains why this happens. That Spring Validator is still Java 1.4 compliant, so clazz has to be a raw Class with no generic type. However, per the Spring 3.0 javadocs, Validator's supports method has been updated to take a Class<?>, so it would remove this error.

Community
  • 1
  • 1
Kaleb Brasee
  • 48,461
  • 8
  • 103
  • 110