<div dir="ltr">Denis,<div><br></div><div style>Could you try and change your bean Bar into this:</div><div style><br></div><div style>    @Named</div><div style><span class="">    @ValidateOnExecution</span>(type=ExecutableType.<span class="">IMPLICIT</span>)</div>
<div style>    public<span class=""> </span>class<span class=""> Bar </span>implements<span class=""> Foo {</span></div><div style><br></div><div style>        @Override</div><div style><span class="">        public</span> <span class="">void</span> doStuff(String v) {}</div>
<div style>    }</div><div style><br></div><div style>This should cause the interceptor to be registered for Bar, the reason being that the portable extension is invoked only for those types annotated or meta-annotated with one of @Valid, @Constraint or @ValidateOnExecution.</div>
<div style><br></div><div style>As your actual bean class has none of these annotations, the interceptor isn&#39;t registered. The spec foresees ExecutableType.<span class="">IMPLICIT for this case, which itself doesn&#39;t change semantics, it is only used as marker (see [1] for the details).</span></div>
<div class="gmail_extra"><br><div class="gmail_quote">2013/7/8 Denis Silva <span dir="ltr">&lt;<a href="mailto:denis.analistajava@gmail.com" target="_blank">denis.analistajava@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>One more information, </div><div><br></div><div>This is the source code of the annotation that enabled the interception,</div><div><br></div><div>It is not missing @Inherited?</div></div></blockquote><div>
<br></div><div style>No, I don&#39;t think so.</div><div style><br></div><div style>@Inherited causes only superclass annotations to be inherited. Annotations on other elements (interfaces, methods etc.) can not be inherited that way. We add @MethodValidated directly to each executable to be validated in the portable extension, its presence on super-types is never taken into account.</div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.CONSTRUCTOR })</div>
<div>@Retention(RetentionPolicy.RUNTIME)</div><div>@InterceptorBinding</div><div>public @interface MethodValidated {</div><div>
}</div></div></blockquote><div><br></div><div style>--Gunnar</div><div style><br></div><div style>[1] <a href="http://beanvalidation.org/1.1/spec/#integration-general-executable">http://beanvalidation.org/1.1/spec/#integration-general-executable</a></div>
<div style><br></div><div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">
<div class="gmail_extra">2013/7/8 Denis Silva <span dir="ltr">&lt;<a href="mailto:denis.analistajava@gmail.com" target="_blank">denis.analistajava@gmail.com</a>&gt;</span><br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Gunnar, <div><br></div><div>I&#39;m using glassfish 4.0, that uses hibernate validator 5.0.0.Final. </div>

<div><br></div><div>Debugging ValidationExtension for a while, i found one problem (may be not). </div>
<div>When i use validations constraints in the abstract class, the ValidationEnabledAnnotatedType that enable the interception of the bean, is applied on the subclass implementation and the abstract class,<span style="font-family:arial,sans-serif;font-size:12.727272033691406px"> but when i use an interface, the wrappedType is applied just in the interface.</span></div>


<div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></span></div><div><font face="arial, sans-serif">That way, the interface implementation will never be intercepted, right?</font><br></div>


<div><br></div><div><font face="arial, sans-serif">I will create an entry on forum, but there is no stacktrace in my case, the expected validation just not work.</font></div><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>


</span></div><div><font face="arial, sans-serif">Att,</font></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">

2013/7/6 Gunnar Morling <span dir="ltr">&lt;<a href="mailto:gunnar@hibernate.org" target="_blank">gunnar@hibernate.org</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I don&#39;t think that&#39;s a spec problem.</div>
<div><br></div><div>The @NotNull constraint should be validated, no matter wether Foo is an interface or an abstract class. Generally constraints on overridden/implemented methods are to be considered, you only may not add any more parameter constraints in subclasses/implementations.</div>



<div><br></div><div>Are you using the Hibernate Validator CDI portable extension? Which container do you use? Could you create an entry with the complete stack trace and a detailed description of your environment to <a href="https://forum.hibernate.org/viewforum.php?f=9" target="_blank">https://forum.hibernate.org/viewforum.php?f=9</a>?</div>



<div><br></div><div>--Gunnar</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/6 Denis Silva <span dir="ltr">&lt;<a href="mailto:denis.analistajava@gmail.com" target="_blank">denis.analistajava@gmail.com</a>&gt;</span><br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr"><div>Hi, </div><div><br></div><div>
I&#39;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><span><font color="#888888">
<div><br></div>-- <br>Denis Tiago<br></font></span></div>
<br></div></div>_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br></blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br>

Denis Silva<br>
Analista Programador Java<br>11 - 8334-9915
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Denis Silva<br>Analista Programador Java<br>11 - 8334-9915
</div>
</div></div><br>_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br></blockquote></div><br></div></div>