On Mon, May 28, 2012 at 04:58:33PM +0100, sebb wrote: > On 28 May 2012 16:39, <celes...@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.
There was no consensus in using this notation in the first place. There is absolutely no need for an explicit conversion in this case. "Number" is very appropriate to store _any_ number type with the sole expectation being that it the error message prints that number. It's not because implicit conversion can cause problems that it always does. And there is no need to add constructors in order to force passing arguments of the same type: assuming that exceptions should catch wrong type uses is like assuming that they could detect wrong variable use. Gilles > > > > > 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-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org