在我的代码中,我有很多“死代码”警告。 问题是我有这样的代码
public void myMethod(final String text) {
if(CONST_FLAG && something == true) {
doMyMethod(text);
}
}
CONST_FLAG 是构建配置常量。当 CONST_FLAG 为 false 时,我会收到死代码的警告。如果我说我想抑制警告,当标志为 true 时,我会看到“不必要的抑制”警告。
有办法避免吗?
最佳答案
您可以使用以下路径将 Eclipse 配置为在某些情况下不显示警告,例如死代码
、未使用的导入
等:-
Go to Windows -> Preferences -> Java -> Compiler -> Errors/ Warnings -> Potential Programming Problems -> Set
Dead Code
to Ignore.
关于java - Eclipse 中无用的烦人警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13568792/