[hibernate-dev] Hibernate Validator and parametrized types

Gunnar Morling gunnar.morling at googlemail.com
Mon Dec 7 19:01:52 EST 2009


Hi,

according to the JSR 303 spec type parameters of constraint validator types
must not resolve to parametrized types (though the spec mentions such
validator types might be allowed in future versions). To my understanding
that means that validators as the following one are invalid with respect to
the BV spec:

public class SomeValidator implements ConstraintValidator<MyAnnotation,
List<Integer>> {
  ...
}

while the next one is valid:

public class SomeValidator implements ConstraintValidator<MyAnnotation,
List> {
  ...
}

Nevertheless also the first validator seems to work fine with HV. So does HV
here do something more than defined in the spec? If that's the case, I
wonder whether there shouldn't be some kind of switch in HV to be activated
explicitely in order to allow for this working. That way people might use
that feature but are made aware that other BV implementations might reject
such validators. WDYT?

Thanks, Gunnar



More information about the hibernate-dev mailing list