[bv-dev] Container element validation for arrays

Marco Molteni moltenma at gmail.com
Thu Apr 20 02:20:41 EDT 2017


@Gunnar
I agree that is better to omit (until clarification) the array problem from
the spec.
Could you give a try contacting the spec lead for the JDK, as suggested by
Michael and Emmanuel, to see if a (future) clean solution is possible?

>From a more realistic perspective (seeing the schedule and what happens in
other JSR) I think that the solution you and Guillaume suggested (backward
compatibility and wait for the 2.1) doesn't have many alternatives.

Thanks


On Wed, Apr 19, 2017 at 10:07 PM, Michael Nascimento <misterm at gmail.com>
wrote:

> 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
>
>
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20170420/a4416cb9/attachment.html 


More information about the beanvalidation-dev mailing list