<div dir="ltr"><div>Hi, </div><div><br></div><div>I'm doing some tests with bean validation, and i have some doubts about the behavior of method constraints on inheritance hierarchies.</div><div>The specification tells about Liskov substitution, on method constraints within inheritance hierarchies, but i made the test bellow with </div>
<div>the reference implementation ( hiberante validator 5.1 ), and not understand if this is a bug in implementation or my misunderstanding the specification.</div><div><br></div><div>public interface Foo {</div><div> public void doStuff(@NotNull String v);</div>
<div>}</div><div><br></div><div>@Named</div><div>public class Bar implements Foo {</div><div> public void doStuff(String v) {}</div><div>}</div><div><br></div><div>Calling bar.doStuff(null), the validation is not fired.</div>
<div>But if i changed Foo interface to an abstract class, and made Bar extends it, the validation is fired and a ConstraintViolationException is propagated.</div><div>The test was done with cdi.</div><div><br></div><div>What should be the appropriate behavior?</div>
<div><br></div>-- <br>Denis Tiago<br></div>