Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8273168: Remove superfluous use of boxing in java.desktop
Reviewed-by: aivanov
  • Loading branch information
turbanoff authored and aivanov-jdk committed Sep 7, 2021
1 parent 270a9d9 commit 708407e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1318,7 +1318,7 @@ private void mergeNativeTree(Node root)
IHDR_width = getIntAttribute(node, "width");
IHDR_height = getIntAttribute(node, "height");
IHDR_bitDepth =
Integer.valueOf(IHDR_bitDepths[
Integer.parseInt(IHDR_bitDepths[
getEnumeratedAttribute(node,
"bitDepth",
IHDR_bitDepths)]);
Expand Down
3 changes: 1 addition & 2 deletions src/java.desktop/share/classes/java/awt/Font.java
Expand Up @@ -1721,8 +1721,7 @@ public static Font decode(String str) {

if (sizeIndex > 0 && sizeIndex+1 < strlen) {
try {
fontSize =
Integer.valueOf(str.substring(sizeIndex+1)).intValue();
fontSize = Integer.parseInt(str.substring(sizeIndex+1));
if (fontSize <= 0) {
fontSize = 12;
}
Expand Down
18 changes: 9 additions & 9 deletions src/java.desktop/share/classes/javax/swing/text/html/CSS.java
Expand Up @@ -763,13 +763,13 @@ void setBaseFontSize(String size) {

if (size != null) {
if (size.startsWith("+")) {
relSize = Integer.valueOf(size.substring(1)).intValue();
relSize = Integer.parseInt(size.substring(1));
setBaseFontSize(baseFontSize + relSize);
} else if (size.startsWith("-")) {
relSize = -Integer.valueOf(size.substring(1)).intValue();
relSize = -Integer.parseInt(size.substring(1));
setBaseFontSize(baseFontSize + relSize);
} else {
setBaseFontSize(Integer.valueOf(size).intValue());
setBaseFontSize(Integer.parseInt(size));
}
}
}
Expand Down Expand Up @@ -961,13 +961,13 @@ float getPointSize(String size, StyleSheet ss) {
ss = getStyleSheet(ss);
if (size != null) {
if (size.startsWith("+")) {
relSize = Integer.valueOf(size.substring(1)).intValue();
relSize = Integer.parseInt(size.substring(1));
return getPointSize(baseFontSize + relSize, ss);
} else if (size.startsWith("-")) {
relSize = -Integer.valueOf(size.substring(1)).intValue();
relSize = -Integer.parseInt(size.substring(1));
return getPointSize(baseFontSize + relSize, ss);
} else {
absSize = Integer.valueOf(size).intValue();
absSize = Integer.parseInt(size);
return getPointSize(absSize, ss);
}
}
Expand Down Expand Up @@ -2137,11 +2137,11 @@ Object parseHtmlValue(String value) {
*/
int baseFontSize = getBaseFontSize();
if (value.charAt(0) == '+') {
int relSize = Integer.valueOf(value.substring(1)).intValue();
int relSize = Integer.parseInt(value.substring(1));
fs.value = baseFontSize + relSize;
fs.index = true;
} else if (value.charAt(0) == '-') {
int relSize = -Integer.valueOf(value.substring(1)).intValue();
int relSize = -Integer.parseInt(value.substring(1));
fs.value = baseFontSize + relSize;
fs.index = true;
} else {
Expand Down Expand Up @@ -2533,7 +2533,7 @@ Object parseCssValue(String value) {
LengthValue lv;
try {
// Assume pixels
float absolute = Float.valueOf(value).floatValue();
float absolute = Float.parseFloat(value);
lv = new LengthValue();
lv.span = absolute;
} catch (NumberFormatException nfe) {
Expand Down
Expand Up @@ -1262,7 +1262,7 @@ public static int getIntegerAttributeValue(AttributeSet attr,
String istr = (String) attr.getAttribute(key);
if (istr != null) {
try {
value = Integer.valueOf(istr).intValue();
value = Integer.parseInt(istr);
} catch (NumberFormatException e) {
value = def;
}
Expand Down
Expand Up @@ -246,7 +246,7 @@ public void registerTextFlavorProperties(String nat, String charset,
nativeEOLNs.put(format, eoln);
}
if (terminators != null && terminators.length() != 0) {
Integer iTerminators = Integer.valueOf(terminators);
int iTerminators = Integer.parseInt(terminators);
if (iTerminators > 0) {
nativeTerminators.put(format, iTerminators);
}
Expand Down
Expand Up @@ -120,7 +120,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup

if (refreshTimeStr != null) {
try {
minRefreshTime = (Integer.valueOf(refreshTimeStr)).intValue();
minRefreshTime = Integer.parseInt(refreshTimeStr);
} catch (NumberFormatException e) {
}
if (minRefreshTime < DEFAULT_MINREFRESH) {
Expand Down
Expand Up @@ -317,8 +317,8 @@ protected int platformFontCount(Font font, String str) {
private static boolean isXP() {
String osVersion = System.getProperty("os.version");
if (osVersion != null) {
Float version = Float.valueOf(osVersion);
return (version.floatValue() >= 5.1f);
float version = Float.parseFloat(osVersion);
return version >= 5.1f;
} else {
return false;
}
Expand Down

1 comment on commit 708407e

@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.