Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5656

PropertyResolver does not scan for NotNull in annotation tree

    XMLWordPrintableJSON

    Details

      Description

      When annotating a field of a bean with e.g. org.hibernate.validator.constraints.NotEmpty, this implies
      javax.validation.constraints.NotNull, but PropertyValidator only checks for the annotations immediately on the filed not the tree of annotations. As a result Wicket does not mark the field as required in the UI, which it should.

      Also PropertyResolver.findNotNullConstraints() is not even protected, so cannot be patched in a simple way.

      So as a solution I suggest changing findNotNullConstraints() to be protected and rather be something like findConstraints(filter), or findConstraints(clazz), and then in that method method recursively invoking getComposingConstraints to get all constraints, but collecting only those of interest. Possibly some care needs to be taken to prevent infinite recursion where constraints are composed of each other (if that compiles).

        Attachments

          Activity

            People

            • Assignee:
              ivaynberg Igor Vaynberg
              Reporter:
              tkruse Thibault Kruse
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: