flow icon indicating copy to clipboard operation
flow copied to clipboard

Binder.BindingBuilder.bind(String) Javadoc falsely claims automatic JSR-303 support

Open archiecobbs opened this issue 1 month ago • 1 comments

Description of the bug

The Javadoc for Binder.BindingBuilder.bind(String) claims:

For a Binder created using the Binder(Class) constructor, introspection will be used to find a Java Bean property. If a JSR-303 bean validation implementation is present on the classpath, a BeanValidator is also added to the binding.

However, that does not appear to actually be the case - and I can't find anywhere in the code where this actually happens.

Note that all the unit tests that verify JSR 303 behavior appear to be using BeanValidationBinder rather than just Binder.

But this Javadoc does not state that you must be using a BeanValidationBinder for this to work.

Either there some missing code, or the Javadoc needs to be updated to specify that you must be using a BeanValidationBinder for this to work.

Expected behavior

JSR 303 annotations like @Size, etc. will be automatically applied when Binder.BindingBuilder.bind(String) is used to bind a field.

Minimal reproducible example

I don't have one yet. However, if I'm wrong (and I certainly could be) I would simply ask that you point me at the line in the source code where this supposed JSR 303 support is automatically being enabled as described in the Javadoc when you are starting with a plain Binder (not a BeanValidationBinder).

Versions

  • Vaadin / Flow version: 24.3.12
  • Java version: 17
  • OS version: Mac OS

archiecobbs avatar May 21 '24 18:05 archiecobbs