FindBugs 新公式
我经常犯这种错误,而不是:
Toast.makeText(this, getString(R.string.string_id), Toast.LENGTH_SHORT).show();
我这样做:
Toast.makeText(this, getString(R.string.string_id), Toast.LENGTH_SHORT);
我认为,这应该可以用 FindBugs(或任何其他静态分析实用程序)检测到,我目前在 Eclipse 中使用它。
条件:
- 静态调用
- 我们不保存返回值
消息类似:
您显然忘记保存调用的返回值,或者您缺少对返回的 Toast 变量的
.show()
调用
此消息严格局限于此类错误,但它可能包含更多条件或此可能是一些常见的错误。
但我确实怀念的是一些教程,我们如何向 FindBugs 数据库添加新食谱。您能否指出我在搜索中未找到的地方,或者为我提供另一种解决方案来查找此类问题?
I often do this kind of mistake, instead of:
Toast.makeText(this, getString(R.string.string_id), Toast.LENGTH_SHORT).show();
i do this:
Toast.makeText(this, getString(R.string.string_id), Toast.LENGTH_SHORT);
I think, this should be detectable with FindBugs (or any other static analysis utility), which I currently use with Eclipse.
Conditions:
- static call
- we don't save the returned value
Message similar to:
You apparently forgot to save returned value of call, or you're missing
.show()
call on returned Toast variable
This message is strictly localized to this type of mistake, but it could contain more conditions or this can be some common mistake.
But what I do miss, is some tutorial, how can we add new recipes to FindBugs database. Can you please point me to place I haven't found in my search or offer me another solution for finding this kind of problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
到目前为止,我可以看到两个可以帮助您的链接:
前者符合条件我想,作为一个教程。
So far I can see two links that can help you:
The former qualifies as a tutorial, I guess.