Gunnar, thanks very much for your prompt response. I'd be very glad to see BVAL-237
be accepted in an upcoming JSR MR!
Of course, the expression stuff does not have to go into the spec. It's quite sufficient if we implement these things in applications but doing so in a portable way would be great.
I'm currently writing my diploma thesis on a project that heavily relies on constraints. While investigating literature on constraint programming, I recognized that the current BVAL constraints can be seen as unary constraints (they restrict exactly one variable, that is, the value of the field/method that is annotated with the constraint annotation). With the expression stuff I'm trying to build binary and maybe even n-ary constraints, which allow expressing relations between variables. As you already pointed out, this is currently only possible with @ScriptAssert (maybe this one should finally go into the spec as well? ;)).
Maybe you'll here more requests from my side, regarding alignment to constraint programming approaches, if that's okay ;)
Finally, again on the topic of exposing the bean. Do you thing we could expose the ValueContext/rootBean/leafBean in Hibernate Validator to the ConstraintValidationContext already, so that we I could at least implement these constraints as Hibernate specific constraints?
Just FYI, the OVal validation framework also allows accessing the validated bean, see http://oval.sourceforge.net/userguide.html#d4e493
(first parameter of the isSatisfied method).
Again, thanks, Gunnar!