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

Remove deprecated methods in sun.util.logging.PlatformLogger

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs

      PlatformLogger.Level enum class is defined in JDK-8010309. The current static final constant fields representing the levels can be converted from int to Level enum constants.

      It will be source compatible if the existing code does not bind level to the type in the source.
      e.g. reference the static final constants in the following ways:
         logger.isLoggable(PlatformLogger.FINEST)
         logger.setLevel(PlatformLogger.FINEST)
         if (logger.getLevel() == PlatformLogger.FINEST)...

      JFX 8 is built with JDK 7 but will be upgraded to build with JDK 8. In addition, it references the type of PlatformLogger static final constants in a few places. For example,

              String levelString = System.getProperty("log.lens");
              int level = PlatformLogger.SEVERE;
              if (levelString != null) {
                  try {
                      level = Integer.parseInt(levelString);
                  } catch (NumberFormatException nfe) {
                      try {
                          level = PlatformLogger.class
                                  .getField(levelString.toUpperCase())
                                  .getInt(null);
                      } catch (Exception e) { }
                  }
              }
              logger.setLevel(level);

      JFX can migrate to use the PlatformLogger.Level that will simply the above code:
              String levelString = System.getProperty("log.lens", "SEVERE").toUpperCase();
              logger.setLevel(PlatformLogger.Level.valueOf(levelString);

      Another place in JFX:
              final int level = LOGGER.getLevel();
              if (level > PlatformLogger.WARNING &&
                  level != PlatformLogger.OFF) {
                  LOGGER.setLevel(PlatformLogger.WARNING);
              }

      This can be changed to:
              if (LOGGER.level() > PlatformLogger.WARNING &&
                  LOGGER.level() != PlatformLogger.OFF) {
                  LOGGER.setLevel(PlatformLogger.WARNING);
              }

      There is native code in JFX that also depends on these fields that need to migrate to use the new API.

      We can fix this bug once JFX 8 removes all references to int level and switches to build with jdk8 b86 (or the promoted build where JDK-8011380 is fixed.

            dfuchs Daniel Fuchs
            mchung Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: