【发布时间】:2012-04-25 08:57:36
【问题描述】:
为什么 FindBugs 会向我提出以下警告:Possible null pointer dereference。
current = myService.getCategoryParent(current);
if (current != null) { // The warning appears here
我不明白如何针对 null 测试变量可以取消引用它。
【问题讨论】:
-
@MichaelBorgwardt 这是一个自定义的
Category类 -
当前是否在此 if 语句之后/之外使用?
-
@BeRecursive: 上面一行用到了。
-
@T.J.Crowder 啊是的,这是有道理的
标签: java nullpointerexception findbugs