由于 Eclipse 未报告“未使用”变量,我有“隐藏”错误,因为它们在断言(前提条件)中使用,例如:
public void method(final String text, ...other parameters) {
assert StringUtils.isNotBlank(text);
...
// The text variable is never used in the method.
// If Eclipse had reported the variable as 'unused' I would have noticed that something is wrong with the code.
...
}
我想告诉 Eclipse 在检查未使用的变量时忽略断言。我怀疑是否有人会传递一个参数来只对其运行一个断言......另外让我知道 FindBugs 或其他工具是否可以做到这一点。