Implementation of the ArrayType in SA-JDI has following side effect:
type "A" is array of component type "C", i.e. "A" == "C[]"
initially:
"A" is accessible from VirtualMachine.allClasses()
"C" is not accessible from VirtualMachine.allClasses()
invocation of method ArrayType.componentType() changes the list of "loaded"
classes in VM,
after "A"->componentType():
"C" becomes accessible from VirtualMachine.allClasses()
In JDWP method ArrayType.componentType() throws expected ClassNotLoadedException as opposite to
SA-JDI where ArrayType.componentType() returns new component type which also becomes
available in VirtualMachine.allClasses().
Diagnostics/output:
-------------------
Comparison output from two connector types: JDWP and SA-JDI agents.
================================================
Running debuggee with JDWP agent...
Running JDWP debugger...
java version "1.6.0_12-ea"
Java(TM) SE Runtime Environment (build 1.6.0_12-ea-b03)
Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[][]": LOADED array sig=[[Ltest03/Debugger;
prepared=true componentType=test03.Debugger[]
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[]": LOADED array sig=[Ltest03/Debugger;
prepared=true componentType=ClassNotLoadedException
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
================================================
Running debuggee...
Running SA-PID debugger...
java version "1.6.0_12-ea"
Java(TM) SE Runtime Environment (build 1.6.0_12-ea-b03)
Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[][]": LOADED array sig=[[Ltest03/Debugger;
prepared=true componentType=test03.Debugger[]
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[]": LOADED array sig=[Ltest03/Debugger;
prepared=true componentType=test03.Debugger
classesByName "test03.Debugger": LOADED class sig=Ltest03/Debugger;
prepared=false
This seems to be a long standing problem.
It least it is reproduced starting from jdk6-b09 till latest jdk7-b48
type "A" is array of component type "C", i.e. "A" == "C[]"
initially:
"A" is accessible from VirtualMachine.allClasses()
"C" is not accessible from VirtualMachine.allClasses()
invocation of method ArrayType.componentType() changes the list of "loaded"
classes in VM,
after "A"->componentType():
"C" becomes accessible from VirtualMachine.allClasses()
In JDWP method ArrayType.componentType() throws expected ClassNotLoadedException as opposite to
SA-JDI where ArrayType.componentType() returns new component type which also becomes
available in VirtualMachine.allClasses().
Diagnostics/output:
-------------------
Comparison output from two connector types: JDWP and SA-JDI agents.
================================================
Running debuggee with JDWP agent...
Running JDWP debugger...
java version "1.6.0_12-ea"
Java(TM) SE Runtime Environment (build 1.6.0_12-ea-b03)
Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[][]": LOADED array sig=[[Ltest03/Debugger;
prepared=true componentType=test03.Debugger[]
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[]": LOADED array sig=[Ltest03/Debugger;
prepared=true componentType=ClassNotLoadedException
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
================================================
Running debuggee...
Running SA-PID debugger...
java version "1.6.0_12-ea"
Java(TM) SE Runtime Environment (build 1.6.0_12-ea-b03)
Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[][]": LOADED array sig=[[Ltest03/Debugger;
prepared=true componentType=test03.Debugger[]
classesByName "test03.Debugger": CLASS NOT LOADED: test03.Debugger
classesByName "test03.Debugger[]": LOADED array sig=[Ltest03/Debugger;
prepared=true componentType=test03.Debugger
classesByName "test03.Debugger": LOADED class sig=Ltest03/Debugger;
prepared=false
This seems to be a long standing problem.
It least it is reproduced starting from jdk6-b09 till latest jdk7-b48