You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "BradWalker (via GitHub)" <gi...@apache.org> on 2023/04/17 03:29:02 UTC
[GitHub] [netbeans] BradWalker commented on a diff in pull request #5714: Cleanup the use of Double primitive wrapper.
BradWalker commented on code in PR #5714:
URL: https://github.com/apache/netbeans/pull/5714#discussion_r1168084984
##########
ide/db/src/org/netbeans/modules/db/explorer/dlg/CreateTableDialog.java:
##########
@@ -471,7 +471,7 @@ public DataTable(TableModel model) {
Map cmap = ColumnItem.getColumnProperty(i);
col.setIdentifier(cmap.get("name")); //NOI18N
columnName = NbBundle.getMessage (CreateTableDialog.class, "CreateTable_" + i); //NOI18N
- columnWidth = (new Double(getFontMetrics(getFont()).getStringBounds(columnName, getGraphics()).getWidth())).intValue() + 20;
+ columnWidth = Double.valueOf(getFontMetrics(getFont()).getStringBounds(columnName, getGraphics()).getWidth()).intValue() + 20;
Review Comment:
Agreed.. Done..
##########
enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/ImportBuildfile.java:
##########
@@ -52,7 +52,7 @@ public ImportBuildfile(File buildFile, JButton okButton) {
}
private void resize() {
- int width = (new Double(jLabelDesc.getFontMetrics(jLabelDesc.getFont()).getStringBounds(jLabelDesc.getText(), getGraphics()).getWidth() / 2.7)).intValue() + 40;
+ int width = Double.valueOf(jLabelDesc.getFontMetrics(jLabelDesc.getFont()).getStringBounds(jLabelDesc.getText(), getGraphics()).getWidth() / 2.7).intValue() + 40;
Review Comment:
Changed..
##########
ide/editor.completion/src/org/netbeans/modules/editor/completion/PatchedHtmlRenderer.java:
##########
@@ -841,7 +841,7 @@ If NO (it's a closing tag)
//Word wrap mode
goToNextRow = true;
- int lastChar = new Double(nextTag - estCharsOver).intValue();
+ int lastChar = Double.valueOf(nextTag - estCharsOver).intValue();
Review Comment:
Agreed. Changed.
##########
java/form/src/org/netbeans/modules/form/layoutdesign/LayoutDesigner.java:
##########
@@ -437,8 +437,8 @@ public void startAdding(LayoutComponent[] comps,
LayoutTestUtils.writeLayoutComponentArray(testCode, "comps", "lc"); //NOI18N
LayoutTestUtils.writeRectangleArray(testCode, "bounds", bounds); //NOI18N
LayoutTestUtils.writeString(testCode, "defaultContId", defaultContId); //NOI18N
- testCode.add("Point hotspot = new Point(" + new Double(hotspot.getX()).intValue() + "," + //NOI18N
- new Double(hotspot.getY()).intValue() + ");"); //NOI18N
+ testCode.add("Point hotspot = new Point(" + Double.valueOf(hotspot.getX()).intValue() + "," + //NOI18N
+ Double.valueOf(hotspot.getY()).intValue() + ");"); //NOI18N
Review Comment:
Agreed. Changed.
##########
platform/openide.awt/src/org/openide/awt/HtmlRenderer.java:
##########
@@ -1057,7 +1057,7 @@ If NO (it's a closing tag)
//Word wrap mode
goToNextRow = true;
- int lastChar = new Double(nextTag - estCharsOver).intValue();
+ int lastChar = Double.valueOf(nextTag - estCharsOver).intValue();
Review Comment:
Ditto.
##########
profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/ClassesListController.java:
##########
@@ -164,8 +164,7 @@ public Object[][] getData(String[] filterStrings, int filterType, boolean showZe
else data[i][4] = (retainedSizeByClass > 0 ? "+" : "") + numberFormat.format(retainedSizeByClass); // NOI18N
}
} else {
- data[i][1] = new Double((double) instancesCount /
- (double) totalLiveInstances * 100);
+ data[i][1] = (double)instancesCount / totalLiveInstances * 100;
Review Comment:
Agreed. Changed.
##########
ide/editor.completion/src/org/netbeans/modules/editor/completion/PatchedHtmlRenderer.java:
##########
@@ -911,7 +911,7 @@ If NO (it's a closing tag)
if (strikethrough || underline) {
LineMetrics lm = fm.getLineMetrics(chars, pos, length - 1, g);
- int lineWidth = new Double(x + r.getWidth()).intValue();
+ int lineWidth = Double.valueOf(x + r.getWidth()).intValue();
Review Comment:
Ditto.
##########
java/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/ImportFoldersPanel.java:
##########
@@ -86,7 +86,7 @@ private void updateDistFolder() {
}
private void resize() {
- int width = (new Double(message.getFontMetrics(message.getFont()).getStringBounds(message.getText(), getGraphics()).getWidth() / 2.7)).intValue() + 40;
+ int width = Double.valueOf(message.getFontMetrics(message.getFont()).getStringBounds(message.getText(), getGraphics()).getWidth() / 2.7).intValue() + 40;
Review Comment:
Agreed. Changed.
##########
platform/openide.awt/src/org/openide/awt/HtmlRenderer.java:
##########
@@ -352,7 +352,7 @@ private static double _renderPlainString(
}
double chWidth = wid / chars.length;
- int estCharsToPaint = new Double(w / chWidth).intValue();
+ int estCharsToPaint = Double.valueOf(w / chWidth).intValue();
Review Comment:
Agreed. Changed.
##########
ide/editor.completion/src/org/netbeans/modules/editor/completion/PatchedHtmlRenderer.java:
##########
@@ -176,7 +176,7 @@ private static double _renderPlainString(
}
double chWidth = wid / chars.length;
- int estCharsToPaint = new Double(w / chWidth).intValue();
+ int estCharsToPaint = Double.valueOf(w / chWidth).intValue();
Review Comment:
Agreed. Changed.
##########
java/form/src/org/netbeans/modules/form/layoutdesign/LayoutDesigner.java:
##########
@@ -465,8 +465,8 @@ public void startMoving(String[] compIds, Rectangle[] bounds, Point hotspot) {
testCode.add("{"); //NOI18N
LayoutTestUtils.writeStringArray(testCode, "compIds", compIds); //NOI18N
LayoutTestUtils.writeRectangleArray(testCode, "bounds", bounds); //NOI18N
- testCode.add("Point hotspot = new Point(" + new Double(hotspot.getX()).intValue() + "," + //NOI18N
- new Double(hotspot.getY()).intValue() + ");"); //NOI18N
+ testCode.add("Point hotspot = new Point(" + Double.valueOf(hotspot.getX()).intValue() + "," + //NOI18N
+ Double.valueOf(hotspot.getY()).intValue() + ");"); //NOI18N
Review Comment:
ditto.
##########
java/form/src/org/netbeans/modules/form/layoutdesign/LayoutDesigner.java:
##########
@@ -519,8 +519,8 @@ public boolean startResizing(String[] compIds,
testCode.add("{"); //NOI18N
LayoutTestUtils.writeStringArray(testCode, "compIds", compIds); //NOI18N
LayoutTestUtils.writeRectangleArray(testCode, "bounds", bounds); //NOI18N
- testCode.add("Point hotspot = new Point(" + new Double(hotspot.getX()).intValue() + "," + //NOI18N
- new Double(hotspot.getY()).intValue() + ");"); //NOI18N
+ testCode.add("Point hotspot = new Point(" + Double.valueOf(hotspot.getX()).intValue() + "," + //NOI18N
+ Double.valueOf(hotspot.getY()).intValue() + ");"); //NOI18N
Review Comment:
ditto.
##########
platform/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BaseTabLayoutModel.java:
##########
@@ -123,7 +123,7 @@ protected int textHeight(int index, JComponent component) {
//No need to calculate for every string
String testStr = "Zgj"; //NOI18N
Font f = getFont();
- textHeight = new Double(f.getStringBounds(testStr,
+ textHeight = Double.valueOf(f.getStringBounds(testStr,
BasicScrollingTabDisplayerUI.getOffscreenGraphics(component).getFontRenderContext()).getWidth()).intValue() + 2;
Review Comment:
Agreed. Changed.
##########
platform/openide.awt/src/org/openide/awt/HtmlRenderer.java:
##########
@@ -1108,7 +1108,7 @@ If NO (it's a closing tag)
}
} else if (brutalWrap) {
//wrap without checking word boundaries
- length = (new Double((w - widthPainted) / chWidth)).intValue();
+ length = Double.valueOf((w - widthPainted) / chWidth).intValue();
Review Comment:
Ditto.
##########
platform/openide.awt/src/org/openide/awt/HtmlRenderer.java:
##########
@@ -1127,7 +1127,7 @@ If NO (it's a closing tag)
if (strikethrough || underline || link) {
LineMetrics lm = fm.getLineMetrics(chars, pos, length - 1, g);
- int lineWidth = new Double(x + r.getWidth()).intValue();
+ int lineWidth = Double.valueOf(x + r.getWidth()).intValue();
Review Comment:
Ditto.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists