I have this annoying situation in my IDE (STS 2.6.0.RELEASE); we have a java class that invokes methods on a groovy class. My IDE indicates, on the catch block, that the catch is unreachable.
I've managed to recreate it easily enough with the following:
Groovy code:
Java code:Code:import javax.mail.MessagingException public interface CanThrowException { void thisCanThrowException() throws MessagingException }
The interesting thing is that if the catch block is removed, the complain then becomes that the MessagingException isn't caught, so a catch block should be added. 'javap' shows the interface was, indeed, constructed saying that the exception is thrown.Code:import javax.mail.MessagingException; class ShouldCatchException { private CanThrowException thing; public void doIt() { try { thing.thisCanThrowException(); } catch( MessagingException e ) { System.out.println("Did we catch it?"); } } }
Via the command line, the build succeeds just fine (no surprise), so it's definitely more of an annoyance than anything else.
Something is not quite right ...
Suggestions? Bug (where do I file it?)?
Thanks!
john


Reply With Quote