[bv-dev] Node#isInIterable() for arrays

Emmanuel Bernard emmanuel at hibernate.org
Fri Jun 16 05:35:19 EDT 2017

I looked at the spec and especially with the method inContainer

Is the pattern supposed to always be inContainer(…).inIterable()?
I suppose no because the spec did not have inContainer before.
So what does it mean, when inIterable() is used, then a inContainer call is implied?

Back to the core subject, I can’t quite remember why I added Map to the list of isIterable() elements.
I suppose that if we follow that path, any container that returns multiple elements should return isIterable == true (i.e. containers that call iterableValue, indexedValue or keyedValue.
So I’d add arrays and any multi-valued container to the definition of isIterable()


> On 15 Jun 2017, at 13:16, Gunnar Morling <gunnar at hibernate.org> wrote:
> Hi all,
> On our road to the Proposed Final Draft (more on that in a separate
> mail a bit), we've almost closed out all the relevant issues.
> One remaining issue is https://hibernate.atlassian.net/browse/BVAL-552
> which is about inconsistent behaviour of Node#isInIterable() when it
> comes to arrays. The spec says this:
>    "isInIterable() returns true if the node represents an object
> contained in an Iterable or in a Map, false otherwise."
> Whereas the TCK has a test case which expects true to be returned for
> arrays, too [1]. Naturally, that's how the RI (and any other
> TCK-compliant implementation) implements this.
> Now my question is, should we simply change the spec and say
>        "isInIterable() returns true if the node represents an object
> contained in an Iterable, Map or an array, false otherwise."
> Given that maps are considered already, the method has to be about
> "things that are iterable" and not java.lang.Iterable (which j.u.Map
> doesn't extend). So considering arrays there seems consistent.
> Or do you, Emmanuel, remember a reason for the current specification
> and it's actually a bug in the TCK?
> Thanks,
> --Gunnar
> [1] https://github.com/beanvalidation/beanvalidation-tck/blob/master/tests/src/main/java/org/hibernate/beanvalidation/tck/tests/validation/PropertyPathTest.java#L196
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev

More information about the beanvalidation-dev mailing list