I'm looking at code that looks like
try {
// Lots of things here.
// More than I'd like to individually hover over every time I see this
}
catch (Exception e) {
// doesn't matter
}
For any particular method in the try block, I can find what checked exceptions it throws. Is there any way to highlight all lines that could throw some checked exception?
In general, I guess I could perhaps remove the catch block, changing the method signature to throw Exception, at which point, I can see all lines in the method that throw an exception (Nevermind: see the update).
In this case, that won't even work nicely, because the code is in a JSP.
Note: if it matters, I'm using MyEclipse standard.
Update: Mark occurrences is on, but simply does nothing in this case. I asked the question because I thought that something about the context made this expected behavior, but it looks like it's a weird edge case or bug.
In eclipse, if you enable "highlight occurrences" and select Exception
, it would highlight all lines that are throwing a (checked) exception that is being caught by the catch block.
Place you cursor in the middle of the word "Exception" (or whatever type of exception you catch) in the catch clause. The word "Exception" and all method calls throwing such an exception will automatically be marked with a gray background highlighting. This feature is called "Mark occurrences" in Eclipse.
If you do not see this happen in your Eclipse installation, hit AltShiftO (O like Occurances) once to toggle the feature and repeat above workflow. Or use the toobar button (second entry in this list of toolbar buttons).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With