JDK-6784504 : SA-JDI: ReferenceType.majorVersion throws ClassCastException for arrays
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2008-12-12
  • Updated: 2023-12-14
  • Resolved: 2016-08-08
Related Reports
Relates :  
Description
Methods ReferenceType.majorVersion/minorVersion should return 0 for arrays, but in case if SA connector is used these methods throw ClassCastException:
java.lang.ClassCastException: sun.jvm.hotspot.oops.ObjArrayKlass cannot be cast to sun.jvm.hotspot.oops.InstanceKlass
        at sun.jvm.hotspot.jdi.ReferenceTypeImpl.majorVersion(ReferenceTypeImpl.java:920)

To reproduce run script from attached archive:
>> run_sajdi.sh <path to the tested JDK> test02.Debuggee test02.Debugger

Example of test run:
>> run_sajdi.sh /set/vmsqe/jdk/7/build/latest/linux-i586/ test02.Debuggee test02.Debugger
Running debuggee: /set/vmsqe/jdk/7/build/latest/linux-i586//bin/java test02.Debuggee
Waiting debuggee
test02: READY!
Running debugger: /set/vmsqe/jdk/7/build/latest/linux-i586//bin/java test02.Debugger sapid 11712
test02: start
canGetClassFileVersion=true
classesByName.size=1
class=test02.Debuggee Ltest02/Debuggee;
 - majorVersion=49
 - minorVersion=0
class=java.lang.String Ljava/lang/String;
 - majorVersion=49
 - minorVersion=0
java.lang.ClassCastException: sun.jvm.hotspot.oops.ObjArrayKlass cannot be cast to sun.jvm.hotspot.oops.InstanceKlass
        at sun.jvm.hotspot.jdi.ReferenceTypeImpl.majorVersion(ReferenceTypeImpl.java:920)
        at test02.Debugger.printVersion(Debugger.java:64)
        at test02.Debugger.main(Debugger.java:46)
java.lang.ClassCastException: sun.jvm.hotspot.oops.ObjArrayKlass cannot be cast to sun.jvm.hotspot.oops.InstanceKlass
        at sun.jvm.hotspot.jdi.ReferenceTypeImpl.minorVersion(ReferenceTypeImpl.java:928)
        at test02.Debugger.printVersion(Debugger.java:71)
        at test02.Debugger.main(Debugger.java:46)
class=java.lang.String[] [Ljava/lang/String;
 - majorVersion=EXPT:java.lang.ClassCastException - sun.jvm.hotspot.oops.ObjArrayKlass cannot be cast to sun.jvm.hotspot.oops.InstanceKlass
 - minorVersion=EXPT:java.lang.ClassCastException - sun.jvm.hotspot.oops.ObjArrayKlass cannot be cast to sun.jvm.hotspot.oops.InstanceKlass
Test FAILED
Killing debuggee

Comments
Closing as WNF. Removing sajdi tests.
08-08-2016