[bv-dev] Container element validation for arrays

Michael Nascimento misterm at gmail.com
Wed Apr 19 16:07:49 EDT 2017


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.

Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20170419/1178c820/attachment.html 


More information about the beanvalidation-dev mailing list