<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">FYI, I&#39;ve created </span><a href="https://hibernate.onjira.com/browse/BVAL-365" target="_blank" style="font-family:arial,sans-serif;font-size:13px">https://hibernate.onjira.com/browse/BVAL-365</a><span style="font-family:arial,sans-serif;font-size:13px"> to clarify the related wording.</span><br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/1/29 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Ok, thanks. How is it with specifying @Valid on parallel types:<div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">interface IFoo1 {</div><div style="font-family:arial,sans-serif;font-size:13px">


    @Valid<br></div><div style="font-family:arial,sans-serif;font-size:13px">    public Bar getBar() {}</div><div style="font-family:arial,sans-serif;font-size:13px">}</div><div style="font-family:arial,sans-serif;font-size:13px">


<br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>interface IFoo2 {</div><div>    @Valid</div><div>    public Bar getBar() {}</div><div>}</div></div><div style="font-family:arial,sans-serif;font-size:13px">


<br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>class FooImpl implements IFoo1, IFoo2 {</div><div>    @Override<br></div><div>    public Bar getBar() {}</div><div>}</div><div><br></div><div>Is this legal? The wording in 4.5.5 seems a bit unclear:</div>


<div><br></div><div>&gt; One must not mark a method return value
          for cascaded validation more than once in a class hierarchy.</div><div><br></div><div>This would render the situation above illegal. But then it goes on:</div><div><br></div><div>&gt; In
          other words, sub types (be it sub classes/interfaces or interface
          implementations) cannot mark the return value for cascaded
          validation if the return value has already been marked on a super
          type or interface.<br></div><div><br></div><div>This describes only the subtype situation, not addressing the situation above and thus implying that it is legal. Maybe we just remove the second sentence? I think it is also understandable on its own right due to the other cases before.</div>

<div><br></div><div>Note that constraint mappings are explicitly forbidden for parallel hierarchies in section 4.4.5.</div><div><br></div><div>Emmanuel, what was our intention when forbidding to specify @Valid several times? Forbidding several occurrences of @ConvertGroup makes sense to me due to the LSP, but several @Valid don&#39;t seem problematic to me.</div>

<div><br></div><div>Or was it to &quot;transitively&quot; cover the @ConvertGroup case since we also say that @ConvertGroup may only be given where @Valid is specified?</div><div><br></div><div>I think it would make sense to either</div>

<div><br></div><div>* Forbid several occurrences of @Valid (subtypes, parallel hierarchies); Allow @ConvertGroup only where @Valid is given; Don&#39;t have additional rules for @ConvertGroup</div><div><br>
</div><div>OR</div><div><br></div><div>* Allow several occurrences of @Valid; Allow @ConvertGroup only where @Valid is given; Forbid several occurrences of @ConvertGroup (subtypes, parallel hierarchies)</div>
<div><br></div><div>WDYT?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>--Gunnar</div>
<div><br></div></font></span></div></div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2013/1/28 Emmanuel Bernard <span dir="ltr">&lt;<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@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">Yes that was the idea to only offer the first variant as valid. If the spec is too unclear open an issue.<br>


<div><div><br>
On 28 janv. 2013, at 17:51, Gunnar Morling &lt;<a href="mailto:gunnar@hibernate.org" target="_blank">gunnar@hibernate.org</a>&gt; wrote:<br>
<br>
&gt; Emmanuel, all,<br>
&gt;<br>
&gt; I need a short confirmation related to the definition of group conversions for the return value of an overriding method. IIUC, the following is legal:<br>
&gt;<br>
&gt; Class Foo {<br>
&gt;     public Bar getBar() {}<br>
&gt; }<br>
&gt;<br>
&gt; Class SubFoo extends Foo {<br>
&gt;<br>
&gt;     @Valid<br>
&gt;     @ConvertGroup(from=..., to=...)<br>
&gt;     @Override<br>
&gt;     public Bar getBar() {}<br>
&gt; }<br>
&gt;<br>
&gt; That is, SubFoo can define a group conversion for the return value as @Valid itself is added in SubFoo only. It would be illegal if @Valid was given in Foo, too.<br>
&gt;<br>
&gt; I think that makes sense since LSP is not violated by the first variant, while it would in the second (a user of Foo wouldn&#39;t be aware of the applying conversions).<br>
&gt;<br>
&gt; Right?<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; --Gunnar<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; beanvalidation-dev mailing list<br>
&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
<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></div></div></div></div>
</blockquote></div><br></div>