tags:

views:

35

answers:

1

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);
    }
+2  A: 

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.

Kaleb Brasee