(null instanceof <anything>) = false
This is guaranteed by the language spec:"At run time, the result of the instanceof operator is true if the value of the RelationalExpression is not null and the reference could be cast (§15.16) to the ReferenceType without raising a ClassCastException. Otherwise the result is false."
IsInstaceOf(NULL, <anything>) = JNI_TRUE
This too is guaranteed by the language spec:"Returns JNI_TRUE if obj can be cast to clazz; otherwise, returns JNI_FALSE. A NULL object can be cast to any class."
For those wondering, these are the relevant Java bugs:
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4074494
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4081023
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.