8248609: [Graal] vmTestbase/nsk/jdi/VoidValue/toString/tostring001/TestDescription.java failed with Unexpected com.sun.jdi.ObjectCollectedException

Reviewed-by: amenkov, lmesnik
This commit is contained in:
Chris Plummer 2024-07-19 21:53:04 +00:00
parent 939fe000a9
commit e7e48a780a

View File

@ -140,6 +140,10 @@ public class tostring001 {
try {
testedObject = testedClass.newInstance(thread, ctor, params, 0);
// Disable collection on testedObject. invokeMethod() will essentially do a
// vm.resume(), which gives GC a chance to run, which might result in this
// object being collected.
testedObject.disableCollection();
} catch (Exception e) {
throw new Failure("unexpected " + e + " when invoking debuggee's constructor");
}
@ -178,6 +182,7 @@ public class tostring001 {
}
display("Checking of debuggee's void value methods completed!");
testedObject.enableCollection();
debuggee.resume();
}