throws
clauses with exceptions that are more generic than the
exceptions that the method actually throws.
Example:
public void createFile() throws Exception { // warning: 'throws Exception' is too broad, masking exception 'IOException'
File file = new File("pathToFile");
file.createNewFile();
}
After the quick-fix is applied:
public void createFile() throws IOException {
File file = new File("pathToFile");
file.createNewFile();
}
Configure the inspection:
throws
clauses
in methods that override a library method.