From 5963a5c1276937167037bce4a4648511645a7a99 Mon Sep 17 00:00:00 2001 From: Ronak Buch Date: Mon, 28 Jun 2021 15:05:44 -0400 Subject: [PATCH] Cleanup deprecated boxing These boxed primitive constructors have been marked for removal in future versions of Java, see https://www.oracle.com/java/technologies/javase/9-deprecated-features.html#JDK-8065614. --- .../CommunicationPerPE/ThreadedFileReader.java | 2 +- src/projections/Tools/NoiseMiner/NoiseMiner.java | 2 +- .../Tools/Streaming/MultiSeriesHandler.java | 6 +++--- .../Tools/Streaming/SingleSeriesHandler.java | 2 +- .../Tools/Streaming/StartupDialogBox.java | 2 +- .../UserStatsOverTime/UserStatsTimeWindow.java | 2 +- src/projections/analysis/Analysis.java | 6 +++--- src/projections/analysis/GenericLogReader.java | 2 +- .../analysis/LogLoaderBeginEventThread.java | 4 ++-- .../analysis/LogLoaderEndEventThread.java | 4 ++-- .../analysis/LogLoaderEndTimeThread.java | 4 ++-- .../analysis/MultiRunDataAnalyzer.java | 4 ++-- .../analysis/ProjectionsConfigurationReader.java | 8 ++++---- src/projections/analysis/RangeHistory.java | 10 +++++----- src/projections/analysis/StsReader.java | 16 ++++++---------- src/projections/ccs/CcsServer.java | 4 ++-- src/projections/gui/ProfileWindow.java | 2 +- 17 files changed, 38 insertions(+), 42 deletions(-) diff --git a/src/projections/Tools/CommunicationPerPE/ThreadedFileReader.java b/src/projections/Tools/CommunicationPerPE/ThreadedFileReader.java index 0752676c..c4b42291 100644 --- a/src/projections/Tools/CommunicationPerPE/ThreadedFileReader.java +++ b/src/projections/Tools/CommunicationPerPE/ThreadedFileReader.java @@ -93,7 +93,7 @@ public void run() { sentMsgCount[pIdx][EPid]++; sentByteCount[pIdx][EPid] += logdata.msglen; - localHistogram.add(new Integer(logdata.msglen)); + localHistogram.add(logdata.msglen); } else if ((logdata.type == ProjDefs.CREATION_BCAST) || (logdata.type == ProjDefs.CREATION_MULTICAST)) { diff --git a/src/projections/Tools/NoiseMiner/NoiseMiner.java b/src/projections/Tools/NoiseMiner/NoiseMiner.java index 8fe09b5d..44b3e13e 100644 --- a/src/projections/Tools/NoiseMiner/NoiseMiner.java +++ b/src/projections/Tools/NoiseMiner/NoiseMiner.java @@ -185,7 +185,7 @@ private Duration period(){ protected NoiseResult(Duration d, long o, int pe, EventWindow ew){ pes = new TreeSet(); this.ew = ew; - pes.add(new Integer(pe)); + pes.add(pe); duration = d; occurrences = o; } diff --git a/src/projections/Tools/Streaming/MultiSeriesHandler.java b/src/projections/Tools/Streaming/MultiSeriesHandler.java index bb098334..6f4e9337 100644 --- a/src/projections/Tools/Streaming/MultiSeriesHandler.java +++ b/src/projections/Tools/Streaming/MultiSeriesHandler.java @@ -481,7 +481,7 @@ private void updateDetailedPlot(){ return; if(b==0) - addKnownCategories(new Integer(b), newDataset); + addKnownCategories(b, newDataset); // Read the number of entries for this bin @@ -502,7 +502,7 @@ private void updateDetailedPlot(){ if(u > 0.0){ // add datapoint to plot String epName = getName(ep,1000); - newDataset.addValue(u, epName, new Integer(b)); + newDataset.addValue(u, epName, Integer.valueOf(b)); } } @@ -519,7 +519,7 @@ private void updateStreamingPlot(){ // TreeMap > plotData; Iterator stepIter = streamingData.keySet().iterator(); - Integer xValue = new Integer(0); + Integer xValue = 0; boolean firstTime = true; diff --git a/src/projections/Tools/Streaming/SingleSeriesHandler.java b/src/projections/Tools/Streaming/SingleSeriesHandler.java index 13e0030d..e4776623 100644 --- a/src/projections/Tools/Streaming/SingleSeriesHandler.java +++ b/src/projections/Tools/Streaming/SingleSeriesHandler.java @@ -74,7 +74,7 @@ public void handleReply(byte[] data){ numData = data.length / 1; for(int i=0; i= numEPs) { - return new Double(extraTable[dataType][col-1][numEPs-epIndex]); + return extraTable[dataType][col - 1][numEPs - epIndex]; } else { - return new Double(dataTable[dataType][col-1][epIndex]); + return dataTable[dataType][col - 1][epIndex]; } } } diff --git a/src/projections/analysis/ProjectionsConfigurationReader.java b/src/projections/analysis/ProjectionsConfigurationReader.java index 967f369a..0bc3b248 100644 --- a/src/projections/analysis/ProjectionsConfigurationReader.java +++ b/src/projections/analysis/ProjectionsConfigurationReader.java @@ -33,10 +33,10 @@ public class ProjectionsConfigurationReader // For convenience of coding, these are static. This will have to // be changed once multiple runs are supported generically in // Projections. - public Long RC_GLOBAL_END_TIME = new Long(-1); - public Long RC_POSE_REAL_TIME = new Long(-1); - public Long RC_POSE_VIRT_TIME = new Long(-1); - public Boolean RC_OUTLIER_FILTERED = Boolean.valueOf(false); + public Long RC_GLOBAL_END_TIME = (long) -1; + public Long RC_POSE_REAL_TIME = (long) -1; + public Long RC_POSE_VIRT_TIME = (long) -1; + public Boolean RC_OUTLIER_FILTERED = Boolean.FALSE; public ProjectionsConfigurationReader(FileUtils fileNameHandler) { diff --git a/src/projections/analysis/RangeHistory.java b/src/projections/analysis/RangeHistory.java index 1c6e1aee..d1b90f76 100644 --- a/src/projections/analysis/RangeHistory.java +++ b/src/projections/analysis/RangeHistory.java @@ -56,7 +56,7 @@ public RangeHistory(String logDirectory) historyStringVector.add(historyString); } } catch (IOException e) { - System.err.println("Error: " + e.toString()); + System.err.println("Error: " + e); } } } @@ -140,10 +140,10 @@ public void add(long start, long end, String name, String procs) { } // added in reverse order starting from the front of the vector. if (rangeName == null) rangeName = new ArrayList(); - rangeName.add(0, new String(name)); - rangeSet.add(0, new Long(end)); - rangeSet.add(0, new Long(start)); - rangeProcs.add(0, new String(procs)); + rangeName.add(0, name); + rangeSet.add(0, end); + rangeSet.add(0, start); + rangeProcs.add(0, procs); numEntries++; } diff --git a/src/projections/analysis/StsReader.java b/src/projections/analysis/StsReader.java index 8b45fc4c..9a2baceb 100644 --- a/src/projections/analysis/StsReader.java +++ b/src/projections/analysis/StsReader.java @@ -234,7 +234,7 @@ public StsReader(String FileName) int Size = Integer.parseInt(st.nextToken()); MsgTable[ID] = Size; } else if (s1.equals("EVENT")) { - Integer key = new Integer(st.nextToken()); + int key = Integer.parseInt(st.nextToken()); if (!userEvents.containsKey(key)) { String eventName = ""; while (st.hasMoreTokens()) { @@ -242,15 +242,14 @@ public StsReader(String FileName) } userEvents.put(key, eventName); userEventNames[userEventIndex] = eventName; - userEventIndices.put(key, - new Integer(userEventIndex++)); + userEventIndices.put(key, userEventIndex++); } } else if (s1.equals("TOTAL_EVENTS")) { // restored by Chee Wai - 7/29/2002 userEventNames = new String[Integer.parseInt(st.nextToken())]; } else if (s1.equals("STAT")) { - Integer key = new Integer(st.nextToken()); + int key = Integer.parseInt(st.nextToken()); if (!userStats.containsKey(key)) { String statName = ""; while (st.hasMoreTokens()) { @@ -258,8 +257,7 @@ public StsReader(String FileName) } userStats.put(key, statName); userStatNames[userStatIndex] = statName; - userStatIndices.put(key, - new Integer(userStatIndex++)); + userStatIndices.put(key, userStatIndex++); } //Read in number of stats } else if (s1.equals("TOTAL_STATS")) { @@ -416,8 +414,7 @@ public Integer getUserEventIndex(int eventID) { } public String getUserEventName(int eventID) { - Integer key = new Integer(eventID); - return userEvents.get(key); + return userEvents.get(eventID); } public String[] getUserEventNames() { @@ -444,8 +441,7 @@ public Integer getUserStatIndex(int eventID) { } public String getUserStatName(int eventID) { - Integer key = new Integer(eventID); - return userStats.get(key); + return userStats.get(eventID); } public String[] getUserStatNames() { diff --git a/src/projections/ccs/CcsServer.java b/src/projections/ccs/CcsServer.java index 08e6eeb7..1a71c631 100644 --- a/src/projections/ccs/CcsServer.java +++ b/src/projections/ccs/CcsServer.java @@ -97,8 +97,8 @@ public CcsServer(String init,byte[] secretKey) if (ip_int<0) ip_int+=(1L<<32); //Make unsigned String ip_dot=""; for (int b=3;b>=0;b--) { - Long l=new Long(0xff&(ip_int>>(8*b))); - ip_dot=ip_dot+l.toString(); + long l = 0xff & (ip_int >> (8 * b)); + ip_dot = ip_dot + l; if (b>0) ip_dot=ip_dot+"."; } diff --git a/src/projections/gui/ProfileWindow.java b/src/projections/gui/ProfileWindow.java index 98d48996..9e49994f 100644 --- a/src/projections/gui/ProfileWindow.java +++ b/src/projections/gui/ProfileWindow.java @@ -503,7 +503,7 @@ private void createDisplayDataSource(){ for (int i=0; i 1.0) { - sigElements.add(new Integer(i)); + sigElements.add(i); } } // copy to an array for Color assignment (maybe that should be