8210512: [Testbug] vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java fails with unexpected size of ClassLoaderReference.referringObjects
Summary: Account for the self-reference that every class has in the constant pool
Reviewed-by: sspitsyn, jcbeyler
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java Mon Sep 10 18:30:24 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java Mon Sep 10 18:57:44 2018 -0400
@@ -118,7 +118,8 @@
// + 'includedIntoReferrersCountTypes.size()' referrers was additionally created
// +1 referrer is classloader
// +1 referrer is debugee class unloader
- int expectedReferrersCount = createInstances + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size() + 2;
+ // +1 self-reference from this_class index
+ int expectedReferrersCount = createInstances + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size() + 3;
ClassObjectReference classObjectReference = debuggee.classByName(className).classObject();
@@ -132,7 +133,8 @@
// Only this referrers should left:
// 1 referrer is classloader
// 1 referrer is debugee class unloader
- expectedReferrersCount = 2;
+ // 1 self-reference from this_class index
+ expectedReferrersCount = 3;
checkClassObjectReferrersCount(classObjectReference, expectedReferrersCount);