pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandro Martini <sandro.mart...@gmail.com>
Subject Re: checks
Date Wed, 11 Apr 2012 09:57:42 GMT
Hi all,

>> Your verifyXXX changes look fine.
> Good, tomorrow I'll start to retrofit some classes.
Just committed.

> But do you like my proposal even for a getLastIndex() ?
> I have seen in many places that a length -1 is used without additional checks ...
In core there are some usage (under some collections) of "length -1"
... so really what do you think on change this with something like
this:

    	// verifyIndexBounds(index, 0, length - 1);  // original
    	verifyIndexBounds(index, 0, (length > 0 ? length - 1: 0)); // new
of course I could refactor this in a simple int getLastIndex() method
with the safer logic on length.

But is this a wanted feature, or do you think it's better to have exceptions ?

Because with that small change, even with the Window clearActive()
change in my workspace (so running ActionMappingTest , trying some
shortcut, then closing it) i get no exception ...

What do you think ?


Bye

Mime
View raw message