Community
Participate
Working Groups
Build F2 From EC: Hi all! I'd like to know if the following is a bug or is the normal behaviour of eclipse. 1) type the code below: int t= Integer.parseInt("1234"); 2) select the line typed in the step 1. 3) try to "surround with try/catch". I do this by pressing alt+S T. Eclipse gives the following messsage: No uncaught exceptions are thrown by the selected code. Catch java.lang.RuntimeException ? I think that eclipse should suggest something like: try { .... } catch (NumberFormatException e) { }
I think Jose's argument is valid. The exception is declared in the target method signature, and it is a valid one to catch on purpose.
Surround with try/catch was implemented that way but I had to remove the functionality because of another bug. The decision was not to catch runtime exceptions. Since Surround with Try/Catch doesn't have a UI the only change is to add a global preference
I think it should never ignore declared exceptions no matter what.
not for 2.0
I just found I've filled a duplicate bug report for this in a hurry - bug#20770. I'm pretty new to bugzilla and I'm sorry for any inconvenience I caused with this.
*** Bug 20770 has been marked as a duplicate of this bug. ***
Reopening
Now all exception are caught which are declared in the Javadoc. Fixed for RC1.
I don't understand the last comment. I have tried the following piece of code... public class RuntimeExceptionTest { /** * * @throws RuntimeException */ public void test() throws RuntimeException { } public void nowarning() { //the call to test should show a warning that a RuntimeException is //thrown and offer the quick fix to either wrap it in a try catch //block, or propagate the exception test(); } } The javadoc doesn't seem to affect the behaviour, or does it need to be the actual html javadoc? In any case, it would be good if it could use the method signature, as oppose to only relying on the javadoc. Could a compiler setting allow this to be on either ignore/warning/error?