NO-JIRA Fix NoProcessFilesBehind build on IBM JDK 8

Remove sun.management.VMManagement to build NoProcessFilesBehind with
IBM JDK 8.
This commit is contained in:
brusdev 2019-08-01 18:12:33 +02:00 committed by Clebert Suconic
parent 6837150d5c
commit b9d7c76d88
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ public class NoProcessFilesBehind extends TestWatcher {
java.lang.management.RuntimeMXBean runtime = java.lang.management.ManagementFactory.getRuntimeMXBean();
java.lang.reflect.Field jvmField = runtime.getClass().getDeclaredField("jvm");
jvmField.setAccessible(true);
sun.management.VMManagement jvm = (sun.management.VMManagement) jvmField.get(runtime);
Object jvm = jvmField.get(runtime);
java.lang.reflect.Method getProcessIdMethod = jvm.getClass().getDeclaredMethod("getProcessId");
getProcessIdMethod.setAccessible(true);
return (Integer) getProcessIdMethod.invoke(jvm);