groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Use static valueOf instead
Date Wed, 06 Dec 2017 09:59:13 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 98bb3a8ab -> 0401f744b


Use static valueOf instead


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

Branch: refs/heads/master
Commit: 0401f744b1d59cd8693bfb9c07940ccc013b91d7
Parents: 98bb3a8
Author: sunlan <sunlan@apache.org>
Authored: Wed Dec 6 17:59:08 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Wed Dec 6 17:59:08 2017 +0800

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/0401f744/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/0401f744/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/0401f744/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 f9fdcb9..144dcd9 100644
--- a/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java
+++ b/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java
@@ -872,7 +872,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/0401f744/src/main/org/codehaus/groovy/syntax/Numbers.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/syntax/Numbers.java b/src/main/org/codehaus/groovy/syntax/Numbers.java
index 2764695..e7a2386 100644
--- a/src/main/org/codehaus/groovy/syntax/Numbers.java
+++ b/src/main/org/codehaus/groovy/syntax/Numbers.java
@@ -237,7 +237,7 @@ public class Numbers
                 if (radix==10 && (value.compareTo(MAX_LONG) > 0 || value.compareTo(MIN_LONG)
< 0) ) {
                     throw new ASTRuntimeException(reportNode, "Number of value "+value+"
does not fit in the range of long, but long was enforced.");
                 } else {
-                    return new Long( value.longValue() );
+                    return Long.valueOf(value.longValue());
                 }
             case 'g':
                 return value ;

http://git-wip-us.apache.org/repos/asf/groovy/blob/0401f744/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 a9f970a..523cc97 100644
--- a/src/main/org/codehaus/groovy/transform/SortableASTTransformation.java
+++ b/src/main/org/codehaus/groovy/transform/SortableASTTransformation.java
@@ -226,7 +226,7 @@ public class SortableASTTransformation extends AbstractASTTransformation
{
         if (includes != null) {
             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/0401f744/src/main/org/codehaus/groovy/transform/ToStringASTTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/ToStringASTTransformation.java b/src/main/org/codehaus/groovy/transform/ToStringASTTransformation.java
index 558f2c9..559e8e0 100644
--- a/src/main/org/codehaus/groovy/transform/ToStringASTTransformation.java
+++ b/src/main/org/codehaus/groovy/transform/ToStringASTTransformation.java
@@ -212,7 +212,7 @@ public class ToStringASTTransformation extends AbstractASTTransformation
{
         if (includes != null) {
             Comparator<ToStringElement> includeComparator = new Comparator<ToStringElement>()
{
                 public int compare(ToStringElement tse1, ToStringElement tse2) {
-                    return new Integer(includes.indexOf(tse1.name)).compareTo(includes.indexOf(tse2.name));
+                    return Integer.valueOf(includes.indexOf(tse1.name)).compareTo(includes.indexOf(tse2.name));
                 }
             };
             Collections.sort(elements, includeComparator);

http://git-wip-us.apache.org/repos/asf/groovy/blob/0401f744/src/main/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
b/src/main/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
index 719cdd4..a32a2ad 100644
--- a/src/main/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
+++ b/src/main/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
@@ -236,7 +236,7 @@ public class TupleConstructorASTTransformation extends AbstractASTTransformation
         if (includes != null) {
             Comparator<Parameter> includeComparator = new Comparator<Parameter>()
{
                 public int compare(Parameter p1, Parameter p2) {
-                    return new Integer(includes.indexOf(p1.getName())).compareTo(includes.indexOf(p2.getName()));
+                    return Integer.valueOf(includes.indexOf(p1.getName())).compareTo(includes.indexOf(p2.getName()));
                 }
             };
             Collections.sort(params, includeComparator);

http://git-wip-us.apache.org/repos/asf/groovy/blob/0401f744/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