R
Robbert Haarman
This would seem to make the program less robust in many interesting
cases. For example, let us say that you have written a program that
uses a number of interfaces to access interesting functionality. When
the time comes to deploy the program, it turns out that on some
platforms it refuses to run because the interface implementations on
those platforms happen to use arrays and your compiler never
considered that the methods in question might throw
ArrayIndexOutOfBoundsException because the implementations you worked
with didn't use arrays at all. You therefore never wrote a catch
clause for those exceptions (since your compiler didn't require you to
and you didn't think to do it) and so your program is invalid in this
particular setting.
It depends on your meaning of "robust". What I had in mind was ensuring
the program is robust (at run time) by rejecting it, unless all possible
run time conditions are taken care of. Thus, rejecting the program based
on unhandled ArrayIndexOutOfBoundsExceptions is a feature, and makes any
program that still passes compilation _more_ robust.
It would also be somewhat tedious to _have_ to handle the possibility
of a NullPointerException on almost every single line of source code.
Nothing requires you to put catch blocks around _every_ line of code.
Regards,
Bob