Adam Lally wrote:
I stumbled across this:private void incrementIllegalIndexUpdateDetector(int typeCode) { this.detectIllegalIndexUpdates[typeCode] = (this.detectIllegalIndexUpdates[typeCode] == Integer.MAX_VALUE) ? Integer.MIN_VALUE : this.detectIllegalIndexUpdates[typeCode] + 1; } I think this is just a really long way of writing: this.detectIllegalIndexUpdates[typeCode]++; Because Integer.MAX_VALUE + 1 == Integer.MIN_VALUE Any objects to my shortening this while I'm in this code?
I wrote that piece, because I guessed (maybe incorrectly) that adding 1 to a max-value would cause an integer-overflow-exception. I looked this up, and according to one source, MAX_VALUE + 1 = -2147483648. (What happens is that any extra bits beyond the 32-nd bit in the correct answer are discarded. Values greater than 2147483647 will "wrap around" to negative values. Mathematically speaking, the result is always "correct modulo 2^32".)
If there is no assumption dependency that this value is non-negative, then I think the change is OK.
-Marshall
