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