<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Ok I yield.&nbsp;</div><div>But you have to admit that making sure a signed int is always 0 or positive is probably the most common though low value usage you will find. And it's low value unless you factor security consideration at which stage it become a very very good idea to litter your code with these.&nbsp;</div><div><br></div><div>@Positive</div><div>int age, nbrOfApples, nbrOfFriends, starRatingAverage, votingParticipants;</div><div><br></div><div><br>On 10 May 2017, at 09:55, Marco Molteni &lt;<a href="mailto:moltenma@gmail.com">moltenma@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">I'd go with default strict to true. It's supported by the mathematical definition of Positive/Negative number.<div><br><div>Very difficult to know the more common scenario (in a quick informal poll between developers near me everybody was confused).</div><div><br></div><div>I found this implementation of Zalando &nbsp;for a monetary amount and they use the strict interpretation for @Positive/Negative annotations and they added&nbsp;<span style="background-color:rgba(27,31,35,0.0470588);color:rgb(36,41,46);font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px">@PositiveOrZero/</span><span style="background-color:rgba(27,31,35,0.0470588);color:rgb(36,41,46);font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px">@NegativeOrZero</span><span style="background-color:rgba(27,31,35,0.0470588);color:rgb(36,41,46);font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px">&nbsp;to include the 0</span>&nbsp; : <a href="https://github.com/zalando/money-validation#usage">https://github.com/zalando/money-validation#usage</a>&nbsp;</div></div><div><br></div><div>The Eclipse Collections (ex-Goldman Sachs collections) defines positive number &gt; 0 (strict case), <a href="https://github.com/goldmansachs/gs-collections">https://github.com/goldmansachs/gs-collections</a>. I would say that the more common scenario is to exclude the 0.</div><div><br></div><div>Marco</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 10, 2017 at 3:40 AM, Matt Benson <span dir="ltr">&lt;<a href="mailto:mbenson@apache.org" target="_blank">mbenson@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My last response might have made sense if I'd have sent my previous<br>
one (to Emmanuel) from the right address:<br>
<br>
"Less common" is an opinion. Are there survey data to back it up? By<br>
contrast, a literal or "strict" interpretation of past or future is<br>
something that cannot be questioned.<br>
<br>
;)<br>
<span class="HOEnZb"><font color="#888888"><br>
Matt<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Tue, May 9, 2017 at 6:52 PM, Matt Benson &lt;<a href="mailto:mbenson@apache.org">mbenson@apache.org</a>&gt; wrote:<br>
&gt; That's why I advocate being literal; then you don't have to guess at<br>
&gt; people's intention. Can't they compose a version that defaults strict to<br>
&gt; false?<br>
&gt;<br>
&gt; Matt<br>
&gt;<br>
&gt; On May 9, 2017 6:22 PM, "Gunnar Morling" &lt;<a href="mailto:gunnar@hibernate.org">gunnar@hibernate.org</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Is inclusive more common really? My feeling is that one would want to<br>
&gt;&gt; exclude 0 more often than not. But I don't have any good idea of how<br>
&gt;&gt; to quantify that...<br>
&gt;&gt;<br>
&gt;&gt; 2017-05-09 19:48 GMT+02:00 Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;:<br>
&gt;&gt; &gt; Well I object :)<br>
&gt;&gt; &gt; You are addressing the less common scenario with this default.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; On 9 May 2017, at 11:09, Gunnar Morling &lt;<a href="mailto:gunnar@hibernate.org">gunnar@hibernate.org</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Hi all,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; So my preference is to make strict() default to true (so it's<br>
&gt;&gt; &gt;&gt; consistent with the default value for orPresent() of @Past/@Future).<br>
&gt;&gt; &gt;&gt; I've filed PR<br>
&gt;&gt; &gt;&gt; <a href="https://github.com/beanvalidation/beanvalidation-api/pull/106" rel="noreferrer" target="_blank">https://github.com/<wbr>beanvalidation/beanvalidation-<wbr>api/pull/106</a>.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; If there are no objections by Thursday, I'll merge it then.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Thanks for any comments,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --Gunnar<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; 2017-05-03 18:13 GMT+02:00 Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;:<br>
&gt;&gt; &gt;&gt;&gt;&gt; On Wed 17-04-26 10:40, Gunnar Morling wrote:<br>
&gt;&gt; &gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; 2017-04-25 20:05 GMT+02:00 Matt Benson &lt;<a href="mailto:mbenson@apache.org">mbenson@apache.org</a>&gt;:<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; After reviewing the proposed API, I have the following<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; questions/suggestions. I apologize if any of these have already been<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; considered:<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; * Should there be a common superinterface for<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; Path$[BeanNode|PropertyNode|<wbr>ContainerElementNode], all of which<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; define<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; the same methods?<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; I've been wondering the same, but come to think that it doesn't give<br>
&gt;&gt; &gt;&gt;&gt;&gt; you much.<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; You (as a user) are going to work with specific node types (as<br>
&gt;&gt; &gt;&gt;&gt;&gt; narrowed down via getKind() + as()), so I would not expect you to<br>
&gt;&gt; &gt;&gt;&gt;&gt; deal<br>
&gt;&gt; &gt;&gt;&gt;&gt; with that super-type in your code. It'd put the declaration of those<br>
&gt;&gt; &gt;&gt;&gt;&gt; methods into one place, which is nice, though I kinda like the<br>
&gt;&gt; &gt;&gt;&gt;&gt; simplicity of the current Node hierarchy, with one specific sub-type<br>
&gt;&gt; &gt;&gt;&gt;&gt; per kind.<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; What do others think?<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; I think that was my idea for not adding a hierarchy back in 1.x.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; * Should ValidatorContext include a self type, as does<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; Configuration?<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; This would facilitate the use of custom ValidatorContext subclasses.<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; Ah, there's even an issue for this:<br>
&gt;&gt; &gt;&gt;&gt;&gt; <a href="https://hibernate.atlassian.net/browse/BVAL-211" rel="noreferrer" target="_blank">https://hibernate.atlassian.<wbr>net/browse/BVAL-211</a>.<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; It would have been great to make this a self-referential type from<br>
&gt;&gt; &gt;&gt;&gt;&gt; the<br>
&gt;&gt; &gt;&gt;&gt;&gt; get-go, but at this point I'd rather leave it as is. Essentially it<br>
&gt;&gt; &gt;&gt;&gt;&gt; only causes a small effort to providers which need to redeclare all<br>
&gt;&gt; &gt;&gt;&gt;&gt; the ValidatorContext methods to return their own specialised<br>
&gt;&gt; &gt;&gt;&gt;&gt; sub-type.<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; The reason I'm reluctant to add it is that users - when upgrading<br>
&gt;&gt; &gt;&gt;&gt;&gt; existing code to BV 2.0 - will get a raw type warning when assigning<br>
&gt;&gt; &gt;&gt;&gt;&gt; ValidatorContext to a variable. I'd prefer to avoid this, at the cost<br>
&gt;&gt; &gt;&gt;&gt;&gt; of the few method re-definitions to be done by providers once, which<br>
&gt;&gt; &gt;&gt;&gt;&gt; seems acceptable.<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; * Should Positive/Negative#strict() default true be provided as<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; #orZero() default false, for commonality with<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; [Past|Future]#orPresent() ?<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; Hum, yes, good point. I think I'd prefer that.<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; @Emmanuel, I vaguely remember we discussed this. Did you see a good<br>
&gt;&gt; &gt;&gt;&gt;&gt; reason for the current default?<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; I don't even vaguely remember talking about it. Sounds good.<br>
&gt;&gt; &gt;&gt;&gt; Actually I remember now, we discussed whether Positive#orZero should<br>
&gt;&gt; &gt;&gt;&gt; be<br>
&gt;&gt; &gt;&gt;&gt; defaulted to true.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; I imagine that &gt;=0 is the most common use case for @Positive (despite<br>
&gt;&gt; &gt;&gt;&gt; the math definition).<br>
&gt;&gt; &gt;&gt;&gt; As for @Negative, I'm on the fence.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; @All, what do you think?<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; Matt<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt; --Gunnar<br>
&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; beanvalidation-dev mailing list<br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
&gt;&gt; &gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br>
&gt;&gt; &gt;&gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt;&gt;&gt;&gt; beanvalidation-dev mailing list<br>
&gt;&gt; &gt;&gt;&gt;&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
&gt;&gt; &gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br>
&gt;&gt; &gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt;&gt;&gt; beanvalidation-dev mailing list<br>
&gt;&gt; &gt;&gt;&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
&gt;&gt; &gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br>
&gt;&gt; &gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt;&gt; beanvalidation-dev mailing list<br>
&gt;&gt; &gt;&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
&gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt; beanvalidation-dev mailing list<br>
&gt;&gt; &gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br>
&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; beanvalidation-dev mailing list<br>
&gt;&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br>
______________________________<wbr>_________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br>
</div></div></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>beanvalidation-dev mailing list</span><br><span><a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a></span></div></blockquote></body></html>