8355632: WhiteBox.waitForReferenceProcessing() fails assert for return type

Reviewed-by: kbarrett
This commit is contained in:
Brent Christian 2025-04-29 20:15:00 +00:00
parent c2485d5f7d
commit bf52eb0358
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,30 @@
/*
* @test
* @summary Test WhiteBox.waitForReferenceProcessing
* @bug 8305186 8355632
* @library /test/lib
* @build jdk.test.whitebox.WhiteBox
* @modules java.base/java.lang.ref:open
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -ea -esa
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* WaitForRefProcTest
*/
import jdk.test.whitebox.WhiteBox;
public class WaitForRefProcTest {
public static void main(String[] args) {
WhiteBox.getWhiteBox().fullGC();
try {
boolean ret = WhiteBox.getWhiteBox().waitForReferenceProcessing();
System.out.println("wFRP returned " + ret);
} catch (InterruptedException e) {
e.printStackTrace();
throw new RuntimeException("test caught InterruptedException");
}
}
}

View File

@ -569,7 +569,7 @@ public class WhiteBox {
try {
wfrp = Reference.class.getDeclaredMethod("waitForReferenceProcessing");
wfrp.setAccessible(true);
assert wfrp.getReturnType() == Boolean.class;
assert wfrp.getReturnType().equals(boolean.class);
Class<?>[] ev = wfrp.getExceptionTypes();
assert ev.length == 1;
assert ev[0] == InterruptedException.class;