首页 文章

突出显示在intelliJ中的catch中未经检查的异常

提问于
浏览
3

我发现了一个突出问题,其中包含了catch子句中的异常 . 这有点与Highlight exception throwers in IntelliJ IDEA有关

给出示例代码如下:

try {
    System.out.print(Double.parseDouble("throws exception"));
} catch (NumberFormatException e){
    System.out.print(e.toString());
}

并将光标定位在日食中的 NumberFormatException 上将突出显示它被抛出的位置

enter image description here

但在IntelliJ中,我无法重现这一点:
enter image description here

当把插入符号放在catch和 NumberFormatException 上时我已经尝试了 highlight usage in file 但它不起作用,我做错了什么?

在方法签名中执行它时,它是相同的,eclipse:

enter image description here

但不是在smartJ

enter image description here

有可能以与日食相同的方式获得这个吗?

EDIT

正如其中一个答案中的yole解释的那样,这特定于IntelliJ中未经检查的异常,即使它们在方法签名中声明,如 Double.parseDouble(String) throws NumberFormatException() 的情况

2 回答

相关问题