Long valueOf instead of new Long

Paul Sandoz paul.sandoz at oracle.com
Thu Jun 26 13:15:28 UTC 2014


On Jun 26, 2014, at 11:58 AM, Chris Hegarty <chris.hegarty at oracle.com> wrote:

> Otavio,
> 
> I skimmed over the patches and they look ok to me. I think they would be suitable for inclusion in jdk9/dev.

Seems fine to me (pending a full test run). 

Just a syntax niggle in the following, too many brackets:

+++ new/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java	2014-06-14 10:16:02.486298421 -0300
@@ -544,7 +544,7 @@
             }
 
             // convert seconds to milliseconds for time comparison
-            currencyPeriod = ((new Long(expTime)).longValue()) * 1000;
+            currencyPeriod = ((Long.valueOf(expTime)).longValue()) * 1000;
             if (currencyPeriod < 0) {
                 /* if currencyTimeLimit is -1 then value is never cached */
                 returnCachedValue = false;
@@ -580,7 +580,7 @@
                 if (tStamp == null)
                     tStamp = "0";
 
-                long lastTime = (new Long(tStamp)).longValue();
+                long lastTime = (Long.valueOf(tStamp)).longValue();


Paul.




More information about the core-libs-dev mailing list