catch ブロックが対応する try ブロックによってスローされる例外よりも一般的なパラメーターを含んでいることを報告します。

例:


  try  {
    File file = new File(pathToFile);
    return file.getAbsolutePath();
  } catch (Exception ex) { // 警告: 'Exception' の 'catch' の範囲が広すぎるため、例外 'RuntimeException' がマスクされています
    return defaultFilePath;
  }

クイックフィックス適用後:


  try  {
    File file = new File(pathToFile);
    return file.getAbsolutePath();
  } catch (RuntimeException ex) {
    return defaultFilePath;
  }

インスペクションの構成: