8309335: Get rid of use of reflection to call Thread.isVirtual() in nsk/jdi/EventRequestManager/stepRequests/stepreq001t.java

Reviewed-by: lmesnik, sspitsyn, alanb
This commit is contained in:
Chris Plummer 2023-08-15 20:55:27 +00:00
parent f66c73d34b
commit 0f5e030bad

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,6 @@
package nsk.jdi.EventRequestManager.stepRequests;
import java.lang.reflect.Method;
import nsk.share.jpda.*;
import nsk.share.jdi.*;
@ -63,7 +62,7 @@ public class stepreq001t {
for (int i=1; i<stepreq001.THRDS_NUM; i++) {
thrs[i] = JDIThreadFactory.newThread(new stepreq001a(readyObj, lockObj,
stepreq001.DEBUGGEE_THRDS[i]));
if (!isVirtual(thrs[i])) {
if (!thrs[i].isVirtual()) {
thrs[i].setDaemon(stepreq001.DAEMON_THRDS[i]);
}
if (argHandler.verbose())
@ -112,15 +111,6 @@ public class stepreq001t {
stepreq001.PASSED;
}
private static boolean isVirtual(Thread thread) {
try {
Method isVirtual = Thread.class.getMethod("isVirtual");
return (boolean) isVirtual.invoke(thread);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
class stepreq001a extends NamedTask {
private Object readyObj;
private Object lockObj;