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

Annotation Processor doesn't detect errors in parameter constraints in inheritance hierarchies

    Details

      Description

      In general, subclasses should not define constraints on method parameters that are stricter than those defined in superclasses. There was a detailed discussion on that in HV-421 Closed .

      For instance, In Spring, with validation enabled, if I have two classes like this:

      public class A {
        public void foo(String s) { ... } 
      }
      public class B extends A {
        public void foo(@NotNull String s) { ... } 
      }
      

      ... I get a ConstraintDefinitionException on the first invocation of B.foo and rightly so.

      I think the annotation processor should be able to detect this (and other cases cases mentioned in HV-421 Closed ) at compile time. It doesn't seem to do that.

        Attachments

          Issue links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: