当我检查StoredCredential的实例是否为空时
if(storedCredential != null){
//do something
}
Run Code Online (Sandbox Code Playgroud)
Netbeans 7.1显示以下警告:
bad operand types for binary operator '=='
first type: com.blah.dbcore.mypublic.beans.StoredCredential
second type: <nulltype>
Run Code Online (Sandbox Code Playgroud)
它正确编译并且不抛出RuntimeExceptions,但Netbeans仍然显示警告.使用'!='检查实例是否为空,会给出相同的错误.
以下代码执行相同的操作,但不太清楚:
if (!(storedCredential instanceof StoredCredential)) {
//do something
}
Run Code Online (Sandbox Code Playgroud)
Netbeans对这个表达没有任何问题.
因为编译没有问题,我假设我将包含类的.jar添加到库中的方式有问题.这是我对这个jar的唯一问题,但是这个.jar中没有其他类给我这个问题.