报告未在相应的块中使用的 catch 形参。 此检查不会报告任何命名为 "ignore"或 "ignored" 的 catch 形参。
示例:
try {
def arr = new int[3]
arr[5] = 5
} catch(Exception ex) {
println('Catching the exception')
}
此处的形参 ex 永远不会在 catch 块中使用。
在应用快速修复后:
try {
def arr = new int[3]
arr[5] = 5
} catch(Exception ignored) {
println('Catching the exception')
}