Skip to content
Permalink
Browse files
8274882: Cleanup redundant boxing in java.desktop
Reviewed-by: serb, pbansal
  • Loading branch information
turbanoff authored and mrserb committed Oct 10, 2021
1 parent 6d1d4d5 commit 2c83559eda410d268c6d8a56d7fd1c34f817cb83
Showing 9 changed files with 15 additions and 18 deletions.
@@ -1708,7 +1708,7 @@ protected String getStringAttr(NamedNodeMap attrs, String name) {
protected boolean getBooleanAttr(Node node, String name, boolean fallback) {
String str = getStringAttr(node, name);
if (str != null) {
return Boolean.valueOf(str).booleanValue();
return Boolean.parseBoolean(str);
}
return fallback;
}
@@ -78,7 +78,7 @@ public class SwingUtilities implements SwingConstants
@SuppressWarnings("removal")
private static boolean getSuppressDropTarget() {
if (!checkedSuppressDropSupport) {
suppressDropSupport = Boolean.valueOf(
suppressDropSupport = Boolean.parseBoolean(
AccessController.doPrivileged(
new GetPropertyAction("suppressSwingDropSupport")));
checkedSuppressDropSupport = true;
@@ -125,8 +125,7 @@ static boolean isWindows() {
@SuppressWarnings("removal")
String systemFonts = AccessController.doPrivileged(
new GetPropertyAction("swing.useSystemFontSettings"));
useSystemFonts = (systemFonts != null &&
(Boolean.valueOf(systemFonts).booleanValue()));
useSystemFonts = Boolean.parseBoolean(systemFonts);
}
checkedWindows = true;
}
@@ -1398,8 +1397,8 @@ protected void initComponentDefaults(UIDefaults table) {
"Tree.openIcon",(LazyValue) t -> MetalIconFactory.getTreeFolderIcon(),
"Tree.closedIcon",(LazyValue) t -> MetalIconFactory.getTreeFolderIcon(),
"Tree.leafIcon",(LazyValue) t -> MetalIconFactory.getTreeLeafIcon(),
"Tree.expandedIcon",(LazyValue) t -> MetalIconFactory.getTreeControlIcon(Boolean.valueOf(MetalIconFactory.DARK)),
"Tree.collapsedIcon",(LazyValue) t -> MetalIconFactory.getTreeControlIcon(Boolean.valueOf( MetalIconFactory.LIGHT )),
"Tree.expandedIcon",(LazyValue) t -> MetalIconFactory.getTreeControlIcon(MetalIconFactory.DARK),
"Tree.collapsedIcon",(LazyValue) t -> MetalIconFactory.getTreeControlIcon(MetalIconFactory.LIGHT),

"Tree.line", primaryControl, // horiz lines
"Tree.hash", primaryControl, // legs
@@ -127,7 +127,7 @@ private static void initStatic() {
if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) {
DebugSettings.init();
}
touchKeyboardAutoShowIsEnabled = Boolean.valueOf(
touchKeyboardAutoShowIsEnabled = Boolean.parseBoolean(
GetPropertyAction.privilegedGetProperty(
"awt.touchKeyboardAutoShowIsEnabled", "true"));
};
@@ -1767,8 +1767,7 @@ private static boolean useSystemAAFontSettings() {
new GetPropertyAction("awt.useSystemAAFontSettings"));
}
if (systemAAFonts != null) {
useSystemAAFontSettings =
Boolean.valueOf(systemAAFonts).booleanValue();
useSystemAAFontSettings = Boolean.parseBoolean(systemAAFonts);
/* If it is anything other than "true", then it may be
* a hint name , or it may be "off, "default", etc.
*/
@@ -37,7 +37,7 @@ public abstract class VSyncedBSManager {

@SuppressWarnings("removal")
private static final boolean vSyncLimit =
Boolean.valueOf(java.security.AccessController.doPrivileged(
Boolean.parseBoolean(java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction(
"sun.java2d.vsynclimit", "true")));

@@ -241,7 +241,7 @@ public static float getQuadDecD2() {
// system property utilities
@SuppressWarnings("removal")
static boolean getBoolean(final String key, final String def) {
return Boolean.valueOf(AccessController.doPrivileged(
return Boolean.parseBoolean(AccessController.doPrivileged(
new GetPropertyAction(key, def)));
}

@@ -428,9 +428,9 @@ static void loadSystemColorsForCDE(int[] systemColors) throws Exception {
for (int i=0;i<8;i++) {
temp = bfr.readLine();
color = temp.substring(1,temp.length());
r = Integer.valueOf(color.substring(0,4),16).intValue() >> 8;
g = Integer.valueOf(color.substring(4,8),16).intValue() >> 8;
b = Integer.valueOf(color.substring(8,12),16).intValue() >> 8;
r = Integer.parseInt(color.substring(0, 4), 16) >> 8;
g = Integer.parseInt(color.substring(4, 8), 16) >> 8;
b = Integer.parseInt(color.substring(8, 12), 16) >> 8;
colors[i] = 0xff000000 | r<<16 | g<<8 | b;
// System.out.println("color["+i+"]="+Integer.toHexString(colors[i]) + "r = " +r + "g="+g+"b="+b);
}
@@ -186,8 +186,7 @@ public void initialize() {
@SuppressWarnings("removal")
String systemFonts = java.security.AccessController.doPrivileged(
new GetPropertyAction("swing.useSystemFontSettings"));
useSystemFontSettings = (systemFonts == null ||
Boolean.valueOf(systemFonts).booleanValue());
useSystemFontSettings = systemFonts == null || Boolean.parseBoolean(systemFonts);

if (useSystemFontSettings) {
Object value = UIManager.get("Application.useSystemFontSettings");
@@ -68,11 +68,11 @@ abstract class TranslucentWindowPainter {
// REMIND: we probably would want to remove this later
@SuppressWarnings("removal")
private static final boolean forceOpt =
Boolean.valueOf(AccessController.doPrivileged(
Boolean.parseBoolean(AccessController.doPrivileged(
new GetPropertyAction("sun.java2d.twp.forceopt", "false")));
@SuppressWarnings("removal")
private static final boolean forceSW =
Boolean.valueOf(AccessController.doPrivileged(
Boolean.parseBoolean(AccessController.doPrivileged(
new GetPropertyAction("sun.java2d.twp.forcesw", "false")));

/**

1 comment on commit 2c83559

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 2c83559 Oct 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.