Hi,

I don't think relying on groups is such a good idea. It's already a complicated area and adding some magic groups won't help.

Is there something preventing us from doing something like:
@Size(3, applyTo = ANNOTATED_ELEMENT)
@Size(10, applyTo = WRAPPED_VALUE)
ListOfStrings nicknames;

ANNOTATED_ELEMENT would be the default and would mean apply the constraint to the currently annotated element.

So List<@Size(10) String> would mean apply the constraint to the annotated element so to the String.

List<@Size(10, applyTo = WRAPPED_VALUE) Optional<String>> would apply the constraint to the String contained in the Optional.

The drawback I can see is that it adds a new reserved method to the @Constraint annotations. To make the migration more smooth, we could make it optional and test the returnType of the method before using the result.

--
Guillaume