[bv-dev] ValueExtractionUnwrappingTest: quibble between spec and TCK

Gunnar Morling gunnar at hibernate.org
Sat Mar 31 08:19:35 EDT 2018

2018-03-31 13:42 GMT+02:00 Guillaume Smet <guillaume.smet at gmail.com>:

> On Sat, Mar 31, 2018 at 11:51 AM, Gunnar Morling <gunnar at hibernate.org>
> wrote:
>> That's an interesting one; it was originally worded exactly like Matt
>> suggests, but then we changed into the current version:
>> https://hibernate.atlassian.net/browse/BVAL-678.
>> I'm sympathetic to the current behaviour of that TCK test and to
>> adjusting the spec wording accordingly. Only you, Guillaume, didn't seem to
>> like that alternative as per our discussion on June 26th, in the Hibernate
>> Validator chat room. Perhaps you remember what made you dislike it back
>> then?
> Ah, yes, I remember now.
> The paragraph is:
>    - If the constraint carries neither the Unwrapping.Unwrap nor the
>    Unwrapping.Skip payload:
>    - If there is exactly one maximally-specific type-compliant value
>       extractor and this extractor is marked with @UnwrapByDefault, this
>       extractor is applied;
>       - Otherwise, no value extractor is applied.
> The initial wording "exactly one maximally-specific type-compliant value
> extractor marked with @UnwrapByDefault" was not accurate because it was not
> clear if we should determine the "maximally-specific type-compliant value
> extractor" first and then check if it is @UnwrapByDefault. This is
> important because, for a given type parameter, we want to get the maximally
> specific value extractor first and then we want to check if it is marked
> with @UnwrapByDefault. We don't want to get the maximally specific (value
> extractor marked with @UnwrapByDefault).
> We also miss a mention of the case when there are 2 maximally-specific
> type-compliant value extractors marked with @UnwrapByDefault.
> I think a wording more in line with our intentions would be:
>    - We determine the maximally-specific type-compliant value extractors.
>    - If there are no matching value extractors or none is marked with
>       @UnwrapByDefault, no value extractor is applied.
>       - If exactly one is marked with @UnwrapByDefault, this very
>       extractor is applied.
> Ok so far.

>    - If more than one are marked with @UnwrapByDefault, a
>       ConstraintDeclarationException is raised.
> I don't think we can or should do this, instead no extractor should be
applied in this case. It'd contradict quite clearly the spec's wording
"Otherwise, no value extractor is applied." Also the idea was that
implicitly applied extractors should be applied implicitly if it's doable
unambiguously, but they shouldn't cause any sort of configuration exception

The original wording could be interpreted in the way above, but +1 for
making it more exhaustive. Can you log a BVAL issue for 2.1?

> I would lean towards implementing it this way in the implementations and
> fix it for BV 2.1.

+1 apart from the case where there are multiple maximally-specific
type-compliant value extractors marked with @ UBD as discussed above.

> --
> Guillaume
> _______________________________________________
> 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/20180331/f50e0411/attachment-0001.html 

More information about the beanvalidation-dev mailing list