0 Replies Latest reply: Apr 23, 2010 5:04 AM by 843793 RSS

    Constraint Validation


      This post could be more related to Generics. But since it is about Annotations and javax.validation.*, I am posting it here.
      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 = 
      I get a compilation error stating:

      Type mismatch: cannot convert from List<Class<? extends ConstraintValidator<capture#4-of ?,?>>> to List<Class<? extends ConstraintValidator<? extends Annotation,?>>>     

      Please let me know what am I missing?

      Thanks in Advance,