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:53 UTC
[1/4] groovy git commit: Trivial refactoring: remove unnecessary
boxing
Repository: groovy
Updated Branches:
refs/heads/master 067ac3e08 -> 9638acdd7
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/d9215f57
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d9215f57
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d9215f57
Branch: refs/heads/master
Commit: d9215f57b66e472734a1728a3498dd009ae1820c
Parents: 067ac3e
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:28:19 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/d9215f57/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/d9215f57/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/d9215f57/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/d9215f57/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/d9215f57/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
}
[4/4] 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/9638acdd
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9638acdd
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9638acdd
Branch: refs/heads/master
Commit: 9638acdd7a171be2e3d3f258c8fdbb560d5e376c
Parents: a7956c5
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:38:06 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/9638acdd/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/4] 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/8ce9b63a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/8ce9b63a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/8ce9b63a
Branch: refs/heads/master
Commit: 8ce9b63a70838189303c465e9260a3767e2e3acb
Parents: d9215f5
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:29:06 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/8ce9b63a/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/8ce9b63a/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;
}
[3/4] groovy git commit: Optimize imports
Posted by su...@apache.org.
Optimize imports
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/a7956c5c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/a7956c5c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/a7956c5c
Branch: refs/heads/master
Commit: a7956c5c09ec9ee2f6129ec6e092ee8d3a7c6f8a
Parents: 8ce9b63
Author: Daniel Sun <su...@apache.org>
Authored: Sat Sep 8 11:31:48 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sat Sep 8 11:31:48 2018 +0800
----------------------------------------------------------------------
.../java/org/codehaus/groovy/ant/AntProjectPropertiesDelegate.java | 1 -
.../groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java | 1 -
2 files changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/a7956c5c/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/AntProjectPropertiesDelegate.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/AntProjectPropertiesDelegate.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/AntProjectPropertiesDelegate.java
index b02c22a..034e77d 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/AntProjectPropertiesDelegate.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/AntProjectPropertiesDelegate.java
@@ -23,7 +23,6 @@ import org.apache.tools.ant.Project;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
http://git-wip-us.apache.org/repos/asf/groovy/blob/a7956c5c/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java
index 07de202..ccb39ea 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java
@@ -35,7 +35,6 @@ import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;