gpt4 book ai didi

java - DLS_DEAD_LOCAL_STORE SuppressWarnings FindBugs 误报

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:12:02 26 4
gpt4 key购买 nike

我正在尝试消除 DLS_DEAD_LOCAL_STORE 的误报

到目前为止,这是我尝试过的:

@SuppressWarnings("DLS_DEAD_LOCAL_STORE")

@edu.umd.cs.findbugs.annotations.SuppressWarnings("DLS_DEAD_LOCAL_STORE")

(基于 SuppressWarnings not working on FindBugs )

@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "DLS_DEAD_LOCAL_STORE", justification = "请走开")

基于 http://osdir.com/ml/java-findbugs-general/2010-06/msg00017.html

但所有选项都无济于事。请指教。使用 Eclipse Indigo。

最佳答案

更多谷歌搜索 + 实验,我终于想出了一个方法来做到这一点。

检查 http://findbugs.sourceforge.net/manual/filter.html 下的第 6 节 .

您需要创建自己的 XML 文件,其中包含所有自定义抑制。然后,您需要通过 findbugs.exclude.filter

让 build.xml 文件知道此文件
 <Match>
<Class name="com.foobar.MyClass" />
<Method name="someMethod" />
<Bug pattern="DLS_DEAD_LOCAL_STORE" />
</Match>

一旦在 XML 中存在,就无需在方法中添加 @SuppressWarnings 标记。

希望这对某人有帮助!

关于java - DLS_DEAD_LOCAL_STORE SuppressWarnings FindBugs 误报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17798612/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com