You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "matthiasblaesing (via GitHub)" <gi...@apache.org> on 2023/05/18 18:09:25 UTC

[GitHub] [netbeans] matthiasblaesing commented on a diff in pull request #5957: Cleanup the use of Double primitive wrapper

matthiasblaesing commented on code in PR #5957:
URL: https://github.com/apache/netbeans/pull/5957#discussion_r1198025613


##########
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] = instancesCount / totalLiveInstances * 100;

Review Comment:
   At least one double cast is necessary else this becomes an integer division, which is not what we want.
   
   ```suggestion
                   data[i][1] = (double) instancesCount / totalLiveInstances * 100;
   ```



##########
platform/openide.explorer/src/org/openide/explorer/view/NodeTableModel.java:
##########
@@ -163,9 +164,9 @@ public void setProperties(Property[] props) {
                     Object o = props[i].getValue(ATTR_ORDER_NUMBER);
 
                     if (o instanceof Integer) {
-                        sort.put(new Double(((Integer) o).doubleValue()), Integer.valueOf(ia));
+                        sort.put(((Integer)o).doubleValue(), ia);

Review Comment:
   It would be good if the code here (lines 167, 169, 222, and 224) would be identical to the code in `NodeTableModel.java`. They already look pretty similar, so there is no need to handle this differently.



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