You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/09/08 03:45:27 UTC

[1/3] groovy git commit: Trivial refactoring: remove unnecessary boxing

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 67e513926 -> 544cbaaad


Trivial refactoring: remove unnecessary boxing


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

Branch: refs/heads/GROOVY_2_5_X
Commit: a3b675a31219a5464ade225cc49a2dec9c3d3bf1
Parents: 67e5139
Author: Daniel Sun <su...@apache.org>
Authored: Sat Sep 8 11:28:19 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sat Sep 8 11:44:41 2018 +0800

----------------------------------------------------------------------
 .../src/main/groovy/groovy/ui/SystemOutputInterceptor.java   | 4 ++--
 .../src/main/groovy/groovy/ui/text/FindReplaceUtility.java   | 8 ++++----
 .../groovy/ui/text/StructuredSyntaxDocumentFilter.java       | 6 +++---
 .../src/main/java/groovy/inspect/swingui/TableSorter.java    | 2 +-
 .../codehaus/groovy/binding/SwingTimerTriggerBinding.java    | 6 +++---
 5 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/a3b675a3/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java
index 3d2a65b..219c213 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java
@@ -35,7 +35,7 @@ public class SystemOutputInterceptor extends FilterOutputStream {
     private static final ThreadLocal<Integer> consoleId = new InheritableThreadLocal<Integer>() {
         @Override
         protected Integer initialValue() {
-            return Integer.valueOf(0);
+            return 0;
         }
     };
 
@@ -121,7 +121,7 @@ public class SystemOutputInterceptor extends FilterOutputStream {
      * @param consoleId id of the Console instance executing the script
      */
     public void setConsoleId(int consoleId) {
-        this.consoleId.set(Integer.valueOf(consoleId));
+        this.consoleId.set(consoleId);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/a3b675a3/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java
index 1a6273f..4ac5b1e 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java
@@ -401,7 +401,7 @@ public final class FindReplaceUtility {
         public FindAction() {
             putValue(Action.NAME, FIND_ACTION_COMMAND);
             putValue(Action.ACTION_COMMAND_KEY, FIND_ACTION_COMMAND);
-            putValue(Action.MNEMONIC_KEY, Integer.valueOf(KeyEvent.VK_F));
+            putValue(Action.MNEMONIC_KEY, KeyEvent.VK_F);
         }
 
         public void actionPerformed(ActionEvent ae) {
@@ -436,7 +436,7 @@ public final class FindReplaceUtility {
         public ReplaceAction() {
             putValue(Action.NAME, REPLACE_ACTION_COMMAND);
             putValue(Action.ACTION_COMMAND_KEY, REPLACE_ACTION_COMMAND);
-            putValue(Action.MNEMONIC_KEY, Integer.valueOf(KeyEvent.VK_R));
+            putValue(Action.MNEMONIC_KEY, KeyEvent.VK_R);
         }
 
         public void actionPerformed(ActionEvent ae) {
@@ -483,7 +483,7 @@ public final class FindReplaceUtility {
         public ReplaceAllAction() {
             putValue(Action.NAME, REPLACE_ALL_ACTION_COMMAND);
             putValue(Action.ACTION_COMMAND_KEY, REPLACE_ALL_ACTION_COMMAND);
-            putValue(Action.MNEMONIC_KEY, Integer.valueOf(KeyEvent.VK_A));
+            putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A);
         }
 
         public void actionPerformed(ActionEvent ae) {
@@ -531,7 +531,7 @@ public final class FindReplaceUtility {
         public CloseAction() {
             putValue(Action.NAME, CLOSE_ACTION_COMMAND);
             putValue(Action.ACTION_COMMAND_KEY, CLOSE_ACTION_COMMAND);
-            putValue(Action.MNEMONIC_KEY, Integer.valueOf(KeyEvent.VK_C));
+            putValue(Action.MNEMONIC_KEY, KeyEvent.VK_C);
             putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("ESCAPE"));
         }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/a3b675a3/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
index b763cd0..9980a35 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
@@ -135,7 +135,7 @@ public class StructuredSyntaxDocumentFilter extends DocumentFilter {
     private MultiLineRun getMultiLineRun(int offset) {
         MultiLineRun ml = null;
         if (offset > 0) {
-            Integer os = Integer.valueOf(offset);
+            Integer os = offset;
 
             SortedSet set = mlTextRunSet.headSet(os);
             if (!set.isEmpty()) {
@@ -208,8 +208,8 @@ public class StructuredSyntaxDocumentFilter extends DocumentFilter {
             
             // clean the tree by ensuring multi line styles are reset in area
             // of parsing
-            SortedSet set = mlTextRunSet.subSet(Integer.valueOf(offset),
-                                                Integer.valueOf(offset + length));
+            SortedSet set = mlTextRunSet.subSet(offset,
+                    offset + length);
             if (set != null) {
                 set.clear();
             }

http://git-wip-us.apache.org/repos/asf/groovy/blob/a3b675a3/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java b/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
index 1f7b522..5fb1715 100644
--- a/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
+++ b/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
@@ -295,7 +295,7 @@ space and avoid unnecessary heap allocation.
     public void sortByColumn(int column, boolean ascending) {
         this.ascending = ascending;
         sortingColumns.removeAllElements();
-        sortingColumns.addElement(Integer.valueOf(column));
+        sortingColumns.addElement(column);
         sort(this);
         super.tableChanged(new TableModelEvent(this));
     }

http://git-wip-us.apache.org/repos/asf/groovy/blob/a3b675a3/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 5d1774f..a289a06 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
@@ -103,14 +103,14 @@ class SwingTimerFullBinding extends AbstractFullBinding implements ActionListene
         // calculate
         if (reportSteps) {
             ((ClosureSourceBinding)sourceBinding).setClosureArgument(
-                    Integer.valueOf((int) (elapsed / stepSize)));
+                    (int) (elapsed / stepSize));
         } else if (reportFraction) {
             ((ClosureSourceBinding)sourceBinding).setClosureArgument(
-                    Float.valueOf((float) elapsed / (float) duration));
+                    (float) elapsed / (float) duration);
             //in Groovy2.0 use valueOf
         } else if (reportElapsed) {
             ((ClosureSourceBinding)sourceBinding).setClosureArgument(
-                    Long.valueOf(elapsed));
+                    elapsed);
             //in Groovy2.0 use valueOf
         } 
 


[3/3] groovy git commit: Trivial refactoring: remove redundant String operation

Posted by su...@apache.org.
Trivial refactoring: remove redundant String operation


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 544cbaaad424fbb775a14b0d1944ee72d5ee9b16
Parents: 8c4c8cb
Author: Daniel Sun <su...@apache.org>
Authored: Sat Sep 8 11:38:06 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sat Sep 8 11:44:57 2018 +0800

----------------------------------------------------------------------
 .../groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/544cbaaa/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java b/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
index c8b67f7..8694ec6 100644
--- a/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
+++ b/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
@@ -191,7 +191,7 @@ class ExtractIndexAndSql {
 
         Matcher matcher = NAMED_QUERY_PATTERN.matcher(sql);
         while (matcher.find()) {
-            newSql.append(sql.substring(txtIndex, matcher.start())).append('?');
+            newSql.append(sql, txtIndex, matcher.start()).append('?');
             String indexStr = matcher.group(1);
             if (indexStr == null) indexStr = matcher.group(3);
             int index = (indexStr == null || indexStr.length() == 0 || ":".equals(indexStr)) ? 0 : Integer.parseInt(indexStr) - 1;


[2/3] groovy git commit: Trivial refactoring: remove unnecessary unboxing

Posted by su...@apache.org.
Trivial refactoring: remove unnecessary unboxing


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 8c4c8cb372a9b9d0fa7bd24b1427153616a15a09
Parents: a3b675a
Author: Daniel Sun <su...@apache.org>
Authored: Sat Sep 8 11:29:06 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sat Sep 8 11:44:50 2018 +0800

----------------------------------------------------------------------
 .../groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java  | 4 ++--
 .../src/main/java/groovy/inspect/swingui/TableSorter.java      | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/8c4c8cb3/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
index 9980a35..796aeb3 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java
@@ -567,8 +567,8 @@ public class StructuredSyntaxDocumentFilter extends DocumentFilter {
         }
         
         private int valueOf(Object obj) {
-            return obj instanceof Integer ? 
-                    ((Integer)obj).intValue() : 
+            return obj instanceof Integer ?
+                    (Integer) obj :
                     (obj instanceof MultiLineRun) ?
                         ((MultiLineRun)obj).start() :
                         ((Position)obj).getOffset();

http://git-wip-us.apache.org/repos/asf/groovy/blob/8c4c8cb3/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java b/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
index 5fb1715..468db34 100644
--- a/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
+++ b/subprojects/groovy-swing/src/main/java/groovy/inspect/swingui/TableSorter.java
@@ -122,9 +122,9 @@ space and avoid unnecessary heap allocation.
 
     private static int compareBooleans(TableModel data, int row1, int column, int row2) {
         Boolean bool1 = (Boolean) data.getValueAt(row1, column);
-        boolean b1 = bool1.booleanValue();
+        boolean b1 = bool1;
         Boolean bool2 = (Boolean) data.getValueAt(row2, column);
-        boolean b2 = bool2.booleanValue();
+        boolean b2 = bool2;
 
         if (b1 == b2)
             return 0;
@@ -174,7 +174,7 @@ space and avoid unnecessary heap allocation.
     public int compare(int row1, int row2) {
         for (int level = 0; level < sortingColumns.size(); level++) {
             Integer column = (Integer) sortingColumns.elementAt(level);
-            int result = compareRowsByColumn(row1, row2, column.intValue());
+            int result = compareRowsByColumn(row1, row2, column);
             if (result != 0)
                 return ascending ? result : -result;
         }