Marcin said:
[...]
It needs not to know how it is called - it is only affecting VM to
check for overflow flag, I think that managed code is not concerned in
any way. As far as I remember MSIL there is appropriate instruction
emitted by a compiler to 'switch' VM to the desired mode.
That's dangerous thinking, IMHO. Â For better or (mainly) worse, that
assumes a method produces no side-effects. Â There are already too many
examples of software doing weird things because at the hardware level,
the FPU state is modified.
The last thing we need is for Java (or any framework) to allow methods
compiled in the past, without a mandate to stipulate checked or
unchecked, to now be subjected to the whim of the caller with respect to
whether its calculations are checked or not.
On this point, I'm definitely in agreement with Arne. Â There may be code
depending on the overflow, and you can't have callers just turning that
off and throwing exceptions instead based on some random change in the
client code.