JDK-4074494 : (jni) instanceof doesn't match specification
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.1.2,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-08-26
  • Updated: 2000-02-29
  • Resolved: 2000-02-29
Related Reports
Duplicate :  

Name: joT67522			Date: 08/26/97

returns true. Indeed the is_instance_of code in interpreter says that
"since null can be cast to any object return true".
(In my case the null is the value of some object field.)

This appears to be contrary to the language spec:
JLS 1.0 section 15.19.2 states
(where syntax is 'RelationalExpression instanceof ReferenceType'):

"the result of the instanceof operator is true if the value of the
RelationalExpression is not null and the reference could be cast to
the ReferenceType without raising a ClassCastException. Otherwise
the result is false."

company - Adobe Systems , email - ###@###.###

WORK AROUND Name: joT67522 Date: 08/26/97 I wish. ======================================================================

EVALUATION The 1.1 behavior is wrong. However, changing it may break code. We need to decide what to do my 1.2 shipping date. sheng.liang@Eng 1997-11-07 Fixed in spec. Per CQI meeting mohammad.gharahgouzloo@Eng 2000-02-29