2018-04-01 12:56 GMT+02:00 Guillaume Smet <guillaume.smet@gmail.com>:
On Sat, Mar 31, 2018 at 2:19 PM, Gunnar Morling <gunnar@hibernate.org> wrote:
    • 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 otherwise.

Yes, I'm stating that the spec is incorrect here and should be corrected.

We quite clearly say that an exception is raised, so we cannot really change that in the spec.

In all the other cases when we have competing value extractors, we throw an error. Why not in this case?

The thinking was that *implicit* unwrapping should only be done if unambiguously possible. I.e. this implicit process shouldn't cause a configuration exception if it cannot be performed.

Typically, you would have your constraints applied on the container elements, then you add another value extractor, and your constraints are then applied silently to the container instead of the container elements. That sounds like the wrong approach.

I think that's just the nature of implicit application of extractors. You also could say "you've applied constraints to the container, then you add a value extractor, and your constraints are then applied silently to the container elements". We went this route to make it comfortable (no Unwrap payload needed) to apply constraints to non-generic wrappers such as OptionalInt.


-- 
Guillaume


_______________________________________________
beanvalidation-dev mailing list
beanvalidation-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev