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

Guillaume Smet guillaume.smet at gmail.com
Sat Mar 31 07:42:33 EDT 2018


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.
      - If more than one are marked with @UnwrapByDefault, a
      ConstraintDeclarationException is raised.

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

-- 
Guillaume
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20180331/04d2a658/attachment.html 


More information about the beanvalidation-dev mailing list