groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [4/4] groovy git commit: Use static valueOf instead
Date Wed, 06 Dec 2017 12:13:05 GMT
Use static valueOf instead

(cherry picked from commit 0401f74)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e7ee5ede
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e7ee5ede
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e7ee5ede

Branch: refs/heads/GROOVY_2_4_X
Commit: e7ee5ede07a93d1eb96904ac4d058958fa1df193
Parents: 9e950ab
Author: sunlan <sunlan@apache.org>
Authored: Wed Dec 6 17:59:08 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Wed Dec 6 20:12:43 2017 +0800

----------------------------------------------------------------------
 src/main/groovy/lang/BenchmarkInterceptor.java               | 8 ++++----
 .../groovy/reflection/stdclasses/NumberCachedClass.java      | 2 +-
 .../runtime/typehandling/DefaultTypeTransformation.java      | 2 +-
 .../codehaus/groovy/transform/SortableASTTransformation.java | 2 +-
 .../codehaus/groovy/binding/SwingTimerTriggerBinding.java    | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e7ee5ede/src/main/groovy/lang/BenchmarkInterceptor.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/BenchmarkInterceptor.java b/src/main/groovy/lang/BenchmarkInterceptor.java
index b460a9a..77bcb64 100644
--- a/src/main/groovy/lang/BenchmarkInterceptor.java
+++ b/src/main/groovy/lang/BenchmarkInterceptor.java
@@ -74,7 +74,7 @@ public class BenchmarkInterceptor implements Interceptor {
      */
     public Object beforeInvoke(Object object, String methodName, Object[] arguments) {
         if (!calls.containsKey(methodName)) calls.put(methodName, new LinkedList());
-        ((List) calls.get(methodName)).add(new Long(System.currentTimeMillis()));
+        ((List) calls.get(methodName)).add(Long.valueOf(System.currentTimeMillis()));
 
         return null;
     }
@@ -87,7 +87,7 @@ public class BenchmarkInterceptor implements Interceptor {
      * @return result
      */
     public Object afterInvoke(Object object, String methodName, Object[] arguments, Object
result) {
-        ((List) calls.get(methodName)).add(new Long(System.currentTimeMillis()));
+        ((List) calls.get(methodName)).add(Long.valueOf(System.currentTimeMillis()));
         return result;
     }
 
@@ -112,14 +112,14 @@ public class BenchmarkInterceptor implements Interceptor {
             result.add(line);
             line[0] = iter.next();
             List times = (List) calls.get(line[0]);
-            line[1] = new Integer(times.size() / 2);
+            line[1] = Integer.valueOf(times.size() / 2);
             int accTime = 0;
             for (Iterator it = times.iterator(); it.hasNext();) {
                 Long start = (Long) it.next();
                 Long end = (Long) it.next();
                 accTime += end.longValue() - start.longValue();
             }
-            line[2] = new Long(accTime);
+            line[2] = Long.valueOf(accTime);
         }
         return result;
     }

http://git-wip-us.apache.org/repos/asf/groovy/blob/e7ee5ede/src/main/org/codehaus/groovy/reflection/stdclasses/NumberCachedClass.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/reflection/stdclasses/NumberCachedClass.java b/src/main/org/codehaus/groovy/reflection/stdclasses/NumberCachedClass.java
index 5c077f3..311cbc2 100644
--- a/src/main/org/codehaus/groovy/reflection/stdclasses/NumberCachedClass.java
+++ b/src/main/org/codehaus/groovy/reflection/stdclasses/NumberCachedClass.java
@@ -55,7 +55,7 @@ public class NumberCachedClass extends CachedClass {
     private Object coerceNumber(Object argument) {
         Class param = getTheClass();
         if (param == Byte.class /*|| param == Byte.TYPE*/) {
-            argument = new Byte(((Number) argument).byteValue());
+            argument = Byte.valueOf(((Number) argument).byteValue());
         } else if (param == BigInteger.class) {
             argument = new BigInteger(String.valueOf((Number) argument));
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/e7ee5ede/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java
b/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java
index a33d6a0..3efb3c9 100644
--- a/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java
+++ b/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java
@@ -885,7 +885,7 @@ public class DefaultTypeTransformation {
         if (value instanceof String) {
             String s = (String) value;
             if (s.length() != 1) throw new IllegalArgumentException("String of length 1 expected
but got a bigger one");
-            return new Character(s.charAt(0));
+            return Character.valueOf(s.charAt(0));
         } else {
             return ((Character) value);
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/e7ee5ede/src/main/org/codehaus/groovy/transform/SortableASTTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/SortableASTTransformation.java b/src/main/org/codehaus/groovy/transform/SortableASTTransformation.java
index f94af2a..e86ad13 100644
--- a/src/main/org/codehaus/groovy/transform/SortableASTTransformation.java
+++ b/src/main/org/codehaus/groovy/transform/SortableASTTransformation.java
@@ -224,7 +224,7 @@ public class SortableASTTransformation extends AbstractASTTransformation
{
         if (!includes.isEmpty()) {
             Comparator<PropertyNode> includeComparator = new Comparator<PropertyNode>()
{
                 public int compare(PropertyNode o1, PropertyNode o2) {
-                    return new Integer(includes.indexOf(o1.getName())).compareTo(includes.indexOf(o2.getName()));
+                    return Integer.valueOf(includes.indexOf(o1.getName())).compareTo(includes.indexOf(o2.getName()));
                 }
             };
             Collections.sort(properties, includeComparator);

http://git-wip-us.apache.org/repos/asf/groovy/blob/e7ee5ede/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/SwingTimerTriggerBinding.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/SwingTimerTriggerBinding.java
b/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/SwingTimerTriggerBinding.java
index 1111cdb..02ea6d8 100644
--- a/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/SwingTimerTriggerBinding.java
+++ b/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/SwingTimerTriggerBinding.java
@@ -110,7 +110,7 @@ class SwingTimerFullBinding extends AbstractFullBinding implements ActionListene
             //in Groovy2.0 use valueOf
         } else if (reportElapsed) {
             ((ClosureSourceBinding)sourceBinding).setClosureArgument(
-                    new Long(elapsed));
+                    Long.valueOf(elapsed));
             //in Groovy2.0 use valueOf
         } 
 


Mime
View raw message