Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 2c83559
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 18 deletions.
Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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;
Expand Down
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/java.desktop/share/classes/sun/awt/SunToolkit.java
Expand Up @@ -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"));
};
Expand Down Expand Up @@ -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.
*/
Expand Down
Expand Up @@ -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")));

Expand Down
Expand Up @@ -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)));
}

Expand Down
Expand Up @@ -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);
}
Expand Down
Expand Up @@ -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");
Expand Down
Expand Up @@ -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")));

/**
Expand Down

1 comment on commit 2c83559

@openjdk-notifier
Copy link

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.