Reputation: 61
I'm in the process of moving to intelliJ from eclipse but I've stumbled upon a highlighting problem with exceptions in catch clauses. This is somewhat linked to Highlight exception throwers in IntelliJ IDEA
Given example code as follows:
try {
System.out.print(Double.parseDouble("throws exception"));
} catch (NumberFormatException e){
System.out.print(e.toString());
}
and positioning the cursor on the NumberFormatException
in eclipse will highlight where it is thrown as in
but in intelliJ I haven't been able to reproduce this:
I've tried highlight usage in file
when placing the caret on both the catch and the NumberFormatException
but it doesn't work, what am I doing wrong?
It is the same when doing it in the method signature, eclipse:
but not in intelliJ
Is it possible to get this in the same way as in eclipse?
EDIT
As explained by yole in one of the answers this is specific to unchecked exceptions in IntelliJ even if they are declared in the method signature as in the case for Double.parseDouble(String) throws NumberFormatException()
Upvotes: 3
Views: 1621
Reputation: 97288
In IntelliJ IDEA, to see where an exception is thrown, you need to put the caret on the catch
keyword, not on the exception class name.
Upvotes: 5