Description:
|
When validating a subtype with a property {{foo}} which extends a superclass which itself has a private constrained field {{foo}}, then constraints from that field in the supertype are evaluated as well, although the shouldn't.
Example:
{code} public class InheritanceTest {
private static class Base {
@Min(5) private final int i = 0; } private static class Sub extends Base {
private final int i = 0; } @Test public void testInheritance() { Set<ConstraintViolation<Sub>> violations = Validation .buildDefaultValidatorFactory() .getValidator() .validate( new Sub() ); assertTrue( violations.isEmpty(), "There should be no violations as the constraints from the supertype field shouldn't apply." ); } } {code}
|