报告其中的异常比该方法实际抛出的异常更通用的 throws 子句。

示例:


  public void createFile() throws Exception { // 警告:'throws Exception' 范围过广,屏蔽异常 'IOException'
    File file = new File("pathToFile");
    file.createNewFile();
  }

在应用快速修复后:


  public void createFile() throws IOException {
    File file = new File("pathToFile");
    file.createNewFile();

配置检查: