Re: Unreachable Catch Block

Hello Kon,

That is a syntax error, and should show up as such in Idea too. It does for
me: "Exception 'java.io.IOException' is never thrown in the corresponding
try block". As far as I'm aware it shouldn't even be possible to disable
it. What build of Idea are you using? Is there anything else usual about
your project? Does it happen with a simple test project?

Chris

My employer uses Eclipse.  Whilst most warnings and errors in IntelliJ
indeed surpass that of Eclipse's in my opinion, I have yet to find an
equivalent analysis in Idea that warns/errors on the following:

import java.io.IOException;

public class ExceptionTest
{
public ExceptionTest()
{
try {
System.out.println("Obviously nothing to trigger the
caught exception below");
} catch (IOException e) {

}
}
}
In Eclipse the } catch (IOException e) { line fails as an error.

Unreachable catch block for IOException. This exception is never
thrown from the try statement body    ExceptionTest.java
/trunk/src/utils    line 12    Java Problem

I'd like to know how to achieve similar in Idea.  This is a roadblock
for Idea adoption at my work, since such errors in Eclipse are marked
as serious compile ones meaning my colleagues using Eclipse cannot
compile {emoticon:class=jive_macro
jive_emote|src=/images/emoticons/sad.gif|__jive_emoticon_name=sad}
Any ideas?

---
Original message URL:
http://devnet.jetbrains.net/message/5267430#5267430



Please sign in to leave a comment.