Uploaded image for project: 'Hibernate Validator'
  1. HV-872

Implement optional relaxation of parameter validation consistent with Section 4.5.5

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.Final
    • Fix Version/s: 5.3.0.Alpha1
    • Component/s: engine
    • Labels:

      Description

      Section 4.5.5 of Validation Specification V 1.1 allows that "providers may implement alternative, potentially more liberal, approaches for handling constrained methods in inheritance hierarchies". By default, an implementation must throw a ConstraintDefinitionException when a parameter constraint is defined on an overriding method.
      The requested feature would implement a property to allow for relaxation of this requirement in two modes. The first mode would simply relax the requirement entirely, i.e. constraints may be defined on overriding methods without limit. The second mode would allow constraints on overriding methods to re-define existing constraints on the overridden method. For example:

      public class A {
        public abstract int m(@NotNull Integer x){...}
      }
      
      public class B extends A {
        public int m(@NotNull(groups={GroupOne.class}) {...}
      }
      

      The second mode preserves some indication in code that a constraint violation may occur.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: