如何避免以下错误 - “取消引用后检查“用户”是否为空。”。 突出显示的代码
OLCC olcc = saveOLCCRequest.getOLCC();
if (olcc != null) {
谢谢。
最佳答案
这要么是 parasoft 分析器中的错误,要么是它能够确定 saveOLCCRequest.getOLCC() 不能返回 null。
无法说出您发布的两行代码片段中的哪一个,但如果 getOLCC() 不可能返回 null,那么您可以通过删除 null 检查来删除警告。
关于java - Parasoft 代码分析器警告 - 'variable is checked for null after being dereferenced',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18098012/