8073908: Replace hotspot/testlibrary use of sun.management with public API
Summary: use java.lang API's instead of sun.management API's.
Reviewed-by: sla, iignatyev, gtriantafill, mchung
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java Thu Feb 26 06:11:56 2015 -0800
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java Fri Feb 27 12:48:06 2015 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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,7 @@
package sun.hotspot.tools.ctw;
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
import java.io.*;
import java.nio.file.Files;
@@ -55,7 +55,7 @@
try {
try {
- if (ManagementFactoryHelper.getCompilationMXBean() == null) {
+ if (ManagementFactory.getCompilationMXBean() == null) {
throw new RuntimeException(
"CTW can not work in interpreted mode");
}
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java Thu Feb 26 06:11:56 2015 -0800
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java Fri Feb 27 12:48:06 2015 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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
@@ -24,7 +24,7 @@
package sun.hotspot.tools.ctw;
import com.sun.management.HotSpotDiagnosticMXBean;
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
import java.io.File;
import java.util.regex.Pattern;
@@ -160,7 +160,7 @@
public static String getVMOption(String name) {
String result;
HotSpotDiagnosticMXBean diagnostic
- = ManagementFactoryHelper.getDiagnosticMXBean();
+ = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
result = diagnostic.getVMOption(name).getValue();
return result;
}