我正在使用javax.validation.Validator
相关类进行基于注释的验证。
Configuration<?> configuration = Validation.byDefaultProvider().configure();
ValidatorFactory factory = configuration.buildValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<ValidatableObject>> constraintViolations = validator.validate(o);
for (ConstraintViolation<ValidatableObject> value : constraintViolations) {
List< Class< ? extends ConstraintValidator< ? extends Annotation,?>>> list =
value.getConstraintDescriptor().getConstraintValidatorClasses();
}
我收到一个编译错误,说明:
类型不匹配:无法从 List< Class< 转换?将 ConstraintValidator< capture#4-of ?,?>>> 扩展到 List< Class< ? 扩展 ConstraintValidator< ? 扩展注释,?>>>
我错过了什么?