Hi experts,

I've got a question regarding the re-definition of default group sequences in inheritance hierarchies, more specifically about the test method GroupSequenceIsolationTest#testCorrectDefaultSequenceInheritance3() in the TCK [1].

There are the following two classes and validation groups defined:

@GroupSequence({ Minimal.class, A.class })
public class A {

    @Max(value = 10, groups = Minimal.class)
    int size;

    @Size(max = 20)
    String name; //A group
}

interface Minimal {}

interface Heavy {}

public class B3 extends A {

    @SafeEncryption(groups = Heavy.class)
    String encryptionKey;

    @Size(max = 20)
    String nickname;
}

The test looks like this:

B3 b = new B3();

//all values invalid
b.name = "this name is too long";
b.nickname = "and this nickname as well";
b.size = 20;
b.encryptionKey = "not safe";

Set<ConstraintViolation<B3>> violations = validator.validate( b );
assertCorrectNumberOfViolations( violations, 2 );
assertCorrectConstraintTypes( violations, Max.class, Size.class );
assertCorrectPropertyPaths( violations, "size", "nickname" );

So, based on the assertions, the re-defined default group sequence only applies to the constraints defined on A but not on those defined on B3.

I'm wondering why that is. Intuitively I would have expected that the re-definition of the default group applies to all types of the hierarchy, so one can re-define the default group at the top of an inheritance hierarchy.

Does anyone know/remember why the behavior is defined like it is?

Thanks,

--Gunnar

[1] https://github.com/beanvalidation/beanvalidation-tck/blob/master/tests/src/main/java/org/hibernate/beanvalidation/tck/tests/constraints/groups/groupsequenceisolation/GroupSequenceIsolationTest.java#L134