commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Brisard <sebastien.bris...@m4x.org>
Subject Re: svn commit: r1343293 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
Date Mon, 28 May 2012 16:27:54 GMT
2012/5/28 sebb <sebbaz@gmail.com>:
> On 28 May 2012 17:12, Sébastien Brisard <sebastien.brisard@m4x.org> wrote:
>> 2012/5/28 sebb <sebbaz@gmail.com>:
>>> On 28 May 2012 16:39,  <celestin@apache.org> wrote:
>>>> Author: celestin
>>>> Date: Mon May 28 15:39:57 2012
>>>> New Revision: 1343293
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1343293&view=rev
>>>> Log:
>>>> Removed explicit conversion from int to Integer.
>>>
>>> -1; I don't think we had concensus on removing it.
>>>
>>>>
>>>> Modified:
>>>>    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
>>>>
>>>> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
>>>> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java?rev=1343293&r1=1343292&r2=1343293&view=diff
>>>> ==============================================================================
>>>> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
(original)
>>>> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
Mon May 28 15:39:57 2012
>>>> @@ -202,23 +202,17 @@ public abstract class RealVector {
>>>>     protected void checkIndices(final int start, final int end) {
>>>>         final int dim = getDimension();
>>>>         if ((start < 0) || (start >= dim)) {
>>>> -            throw new OutOfRangeException(LocalizedFormats.INDEX,
>>>> -                                          Integer.valueOf(start),
>>>> -                                          Integer.valueOf(0),
>>>> -                                          Integer.valueOf(dim
- 1));
>>>> +            throw new OutOfRangeException(LocalizedFormats.INDEX,
start, 0,
>>>> +                                          dim - 1);
>>>>         }
>>>>         if ((end < 0) || (end >= dim)) {
>>>> -            throw new OutOfRangeException(LocalizedFormats.INDEX,
>>>> -                                          Integer.valueOf(end),
>>>> -                                          Integer.valueOf(0),
>>>> -                                          Integer.valueOf(dim
- 1));
>>>> +            throw new OutOfRangeException(LocalizedFormats.INDEX,
end, 0,
>>>> +                                          dim - 1);
>>>>         }
>>>> -        if (end < start){
>>>> +        if (end < start) {
>>>>             // TODO Use more specific error message
>>>>             throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
>>>> -                                                Integer.valueOf(end),
>>>> -                                                Integer.valueOf(start),
>>>> -                                                false);
>>>> +                                                end,
start, false);
>>>>         }
>>>>     }
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>> That's true we didn't. However (see my last message), this is really
>> of little consequence, and I didn't really want to get into a new
>> "to-serialize-or-not-to-serialize-that-s-the-question" endless debate.
>> I was the one who initially defended explicit conversion as opposed to
>> autoboxing, so you need not convince me. I guess most IDEs would
>> signal this auto-boxing.
>
> Depends on the setting.
>
>> Can we assume on this specific case that we
>> are adults who know what they are doing?
>
> The way to signal that is either to use explicit boxing, or use
> @SuppressWarnings("boxing") for that method.
>
> Otherwise, at some point someone else is going to wonder whether the
> boxing is intentional or not.
>
>> Again, this is just to build
>> the message of an exception, so the code virtually ends here.
>> I'm not familiar with -1ing a commit, I think I have to revert it
>> (could you confirm on that?).
>
> The committer either has to revert the commit, or convice the person
> voting -1 to withdraw their objectioin.
>
Would adding the above anotation convince you?

>> I'm happy to, but please find a
>> consensus with Gilles then, and I'm very happy to line up with the
>> outcome of your discussions.
>
> There's another solution in this case, which is to do the boxing
> conversions in the Exceptions by providing ctors for the commonest
> Number cases (e.g. int and long). This would have the advantage that
> it would flag up mixed int and long parameters, which are probably an
> error.
>
>> Kind regards,
>> Sébastien
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message