-
Enhancement
-
Resolution: Fixed
-
P3
-
8
-
b113
-
Verified
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 whereJDK-8011380 is fixed.
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
- relates to
-
JDK-8010309 Improve PlatformLogger.isLoggable performance by direct mapping from an integer to Level
-
- Closed
-
-
JDK-8011380 FX dependency on PlatformLogger broken by 8010309
-
- Closed
-