[bv-dev] Container element validation for arrays

Gunnar Morling gunnar at hibernate.org
Thu Apr 20 04:17:30 EDT 2017

2017-04-19 22:07 GMT+02:00 Michael Nascimento <misterm at gmail.com>:
> On Wed, Apr 19, 2017 at 4:27 PM, Emmanuel Bernard <emmanuel at hibernate.org>
> wrote:
>> But
>>     @Target(FIELD, TYPE_USE)
>>     @interface Size
>>     @Size(2) String[] arrayOfTwoStrings;
>> is ambiguous in Java 8
>> So the JLS is “backward compatible” in the language designer’s view I
>> suppose.
> When you don't change, it's backward compatible indeed. When you do, the
> language design is flawed. So there is a hole in one combination that needs
> to be addressed. Joshua Bloch would write about that all the time, of how
> new features interact in unexpected ways and that's why you have to resist
> changes in the language.
>> They did not anticipate people wanting to add TYPE_USE to an existing
>> annotation and have a side effect on its usage on arrays.
> Exactly, so this is effectively broken and needs to be fixed in the
> language, not in BV. But I'm still afraid we might have got something wrong
> here, so I would rather ask them.

I've sent a mail to the compiler-dev mailing list (best place I could think of):


Let's see what answers we get. I don't think it will be fixed in the
language (how?), esp. given that the JLS is clearly aware of that

> Regards,
> Michael
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev

More information about the beanvalidation-dev mailing list