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

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.

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

1 2 3 4 5 6 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) at compile time. It doesn't seem to do that.

Environment

None

Status

Assignee

Marko Bekhta

Reporter

AlinaM

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

5.0.1.Final
4.3.1.Final

Priority

Major