Jonas, After some considerations I've decided to agree with you. As a common rule we must try to minimize false reports where it is possible. In this particular case the price would be slight inspection slowdown for methods that contain finally clause.
Best regards, Maxim Shafirov JetBrains, Inc / IntelliJ Software http://www.intellij.com "Develop with pleasure!" ----- Original Message ----- From: "Jonas Kvarnstr�m" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 18, 2002 3:07 PM Subject: Re: [Eap-list] Wrong "Condition is always false" detection > Maxim Shafirov wrote: > > >You are quite right! But is this a situation you've meant in your code? > >Isn't it extremely rare <code>try</code>ing a new statement in order to > >catch OutOfMemoryError, is it? If we implement these checkings in inspector > >it would lead one became useless as it would report a lot of possible error > >reports. So we do not take throwing possible RuntimeException's and Error's > >at least for now. > > > Sure, that's rare. > > But I wouldn't want the code inspector to tell me that "this can't > happen" (reader can't be null) when in fact it *can* happen. Possibly > it could tell me that it "can't happen unless there is a > RuntimeException or Error" or something, but I wouldn't want it to tell > me to remove some code or condition that would in the end cause my > program to crash with a NullPointerException instead of handling the > error reasonably gracefully. Maybe it's a server thread that crashes > and the finally clause tried to release a connection to a database or > close a file or whatever, and because the test has been removed (because > IDEA wrongly claimed that it wasn't necessary) some things don't get > close and eventually the entire server crashes due to lack of resources. > > Are you sure it would make the inspector useless? If you get a > RuntimeException or Error and you haven't tried to catch it (which > should be very rare) the exception should simply cause the method to > return prematurely, in which case the code analysis for that method > shouldn't be affected very much. The main reason why taking > RuntimeExceptions into account would seem to be that they can cause the > program to jump abruptly to a finally clause, and the finally clause is > probably there exactly because you want to do some cleanup in case one > of those unexpected errors occur. Of course you've analyzed this in > much more detail than I have so if you say taking this into account > would really make the inspector useless I'll take your word for it. > > > > _______________________________________________ > Eap-list mailing list > [EMAIL PROTECTED] > http://www.intellij.com/mailman/listinfo/eap-list _______________________________________________ Eap-list mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-list
