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

Gunnar Morling gunnar at hibernate.org
Thu Jun 15 07:16:37 EDT 2017


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


More information about the beanvalidation-dev mailing list