What causes the "invalid operand types for the binary operator" == "with the second type <nulltype>?
When I check if an instance of StoredCredential is null
if(storedCredential != null){
//do something
}
Netbeans 7.1 shows the following warning:
bad operand types for binary operator '=='
first type: com.blah.dbcore.mypublic.beans.StoredCredential
second type: <nulltype>
It compiles correctly and does not generate RuntimeExceptions, but Netbeans still shows a warning. Verifying that the instance is not null, with '! = ', Gives the same error.
The following code does the same, but is much less clear:
if (!(storedCredential instanceof StoredCredential)) {
//do something
}
Netbeans has no problem with this expression.
Since it has no compilation problems, I assume that something is wrong with the way I added the .jar containing the class to the library. This is the only problem I encountered with this jar, but no other class in this .jar gives me this problem.
. , , , :
required: String,Object
found: String,SomeClass
reason: actual argument SomeClass cannot be converted to Object by method invocation conversion
, .
( com.blah.lib.SomeClass) NB ( Project 1) , Project 1.
NB ( Project 2) Project 1 com.blah.lib.SomeClass, , Project 2 com.blah.lib.SomeClass.
, , Project 2. .
, , , , - .