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

Upgrade to use PlatformLogger.Level instead of primitive int type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • javafx
    • None

      sun.util.logging.PlatformLogger has been improved in JDK 8 for better performance and also PlatformLogger.Level enum class was defined for better type checking.

      There are several places in JFX binding the level type to int that prohibits the API change that
      is source compatibility with jdk once it's rebuilt. JFX can migrate to use the new PlatformLogger.Level
      enum class so that we can remove the deprecated methods:
          http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8011638

      For example, in glass/glass/src/com/sun/glass/ui/accessible/AccessibleLogger.java:
              // simplified (original code wrapped this with doPrivileged)
              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);

      can be simply changed to:

              String levelString = System.getProperty("log.lens", "SEVERE").toUpperCase();
              logger.setLevel(PlatformLogger.Level.valueOf(levelString);

      glass/src/com/sun/glass/ui/lens/LensLogger.java - has similar code as above and also has native code referencing these constants (glass/glass-lib-lens/src/LensLogger.c)

      Due to the JFX and JDK are not built together, it require many more source files be changed. Suggest to add:
          import static sun.util.logging.PlatformLogger.Level.*;

      in the files referencing PlatformLogger.SEVERE and other constants; then change PlatformLogger.XXX to XXX.

      PlatformLogger.getLevel() to PlatformLogger.level() that will return PlatformLogger.Level object.

            fheidric Felipe Heidrich (Inactive)
            mchung Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: