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/04/04 00:12:06 UTC

[4/7] groovy git commit: 'new String()' is redundant

'new String()' is redundant


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

Branch: refs/heads/master
Commit: b07369a506c1792695fcfaf6d6337ceef7836d4f
Parents: 7e7efff
Author: sunlan <su...@apache.org>
Authored: Wed Apr 4 08:05:38 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Wed Apr 4 08:05:38 2018 +0800

----------------------------------------------------------------------
 .../java/org/apache/groovy/jsondirect/DirectFastStringService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/b07369a5/subprojects/groovy-json-direct/src/main/java/org/apache/groovy/jsondirect/DirectFastStringService.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json-direct/src/main/java/org/apache/groovy/jsondirect/DirectFastStringService.java b/subprojects/groovy-json-direct/src/main/java/org/apache/groovy/jsondirect/DirectFastStringService.java
index 0d7d4ad..a2ed84a 100644
--- a/subprojects/groovy-json-direct/src/main/java/org/apache/groovy/jsondirect/DirectFastStringService.java
+++ b/subprojects/groovy-json-direct/src/main/java/org/apache/groovy/jsondirect/DirectFastStringService.java
@@ -37,7 +37,7 @@ public class DirectFastStringService implements FastStringService {
     @Override
     public String noCopyStringFromChars(char[] chars) {
         if (WRITE_TO_FINAL_FIELDS) {
-            String string = new String();
+            String string = "";
             UNSAFE.putObject(string, STRING_VALUE_FIELD_OFFSET, chars);
             return string;
         } else {