【发布时间】:2017-05-25 04:57:32
【问题描述】:
我正在使用 PMD 和 checkstyle 并使用如下代码
public void testMethod() {
try {
// do something
} catch (Exception e) {
logger.error("Error updating benchmark {} state", benchmarkId, e);
}
}
但它在质量检查过程中失败,因为testmethod 正在捕获Exception。我想使用 @SuppressWarnings("PMD.SignatureDeclareThrowsException") 但它不起作用并尝试搜索应该是正确的注释来处理它但找不到它。
让我知道什么应该是正确的 PMD 注释来抑制在 Intellij Idea 中捕获 exception 的警告。
【问题讨论】:
-
将光标悬停在警告上,使用 ALT + ENTER 键,然后使用右箭头键打开子菜单。该子菜单具有“Suppress for line”或“Suppress for method”等选项。
标签: java intellij-idea pmd suppress-warnings