Does anybody ever wish Java detected & reported integer overflow (via some kind of ArithmeticException) ?
For there to be no compile time, or runtime checking for this fail-slow error seems to me to be a serious limitation in the construction of complex systems.
The simplest assumption that many people fall foul of :-
The above assertion will fail when val = Integer.MIN_VALUE (as it will overflow round to itself)
A very common application of this flawed assertion would be :-
Which will lead to an erroneous value being generated every 1 in ~4294967296 executions.
While the above is poor code (in both J2ME & J2SE), I have seen many examples of its usage.
Another common situation where overflow becomes a brain melter is when using FixedPoint libraries