Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8073908

Replace hotspot/testlibrary use of sun.management with public API

XMLWordPrintable

    • b55

        hotspot/testlibrary references to sun.management.ManagementFactoryHelper that can easily be replaced with java.lang.management.ManagementFactory.

        This will avoid any hotspot tests depending on testlibrary to include
           @modules java.management/sun.management

        --- old/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java 2015-02-25 10:14:17.812658441 -0800
        +++ new/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java 2015-02-25 10:14:17.720658440 -0800
        @@ -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");
                         }
        --- old/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java 2015-02-25 10:14:18.180658447 -0800
        +++ new/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java 2015-02-25 10:14:18.088658445 -0800
        @@ -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;
             }

              hseigel Harold Seigel (Inactive)
              mchung Mandy Chung (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: