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/01/05 12:50:50 UTC
groovy git commit: Revert "Cache the text of GString for better
performance"
Repository: groovy
Updated Branches:
refs/heads/master 628a19aab -> 5262442ad
Revert "Cache the text of GString for better performance"
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5262442a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5262442a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5262442a
Branch: refs/heads/master
Commit: 5262442ad8330cff5dfeae01a244b8bb7771e82b
Parents: 628a19a
Author: sunlan <su...@apache.org>
Authored: Fri Jan 5 20:50:42 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Fri Jan 5 20:50:42 2018 +0800
----------------------------------------------------------------------
src/main/groovy/groovy/lang/GString.java | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/5262442a/src/main/groovy/groovy/lang/GString.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/GString.java b/src/main/groovy/groovy/lang/GString.java
index 5de910f..06ad8dd 100644
--- a/src/main/groovy/groovy/lang/GString.java
+++ b/src/main/groovy/groovy/lang/GString.java
@@ -61,7 +61,6 @@ public abstract class GString extends GroovyObjectSupport implements Comparable,
public static final String[] EMPTY_STRING_ARRAY = new String[0];
public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
- private String string;
private final Object[] values;
public GString(Object values) {
@@ -148,10 +147,6 @@ public abstract class GString extends GroovyObjectSupport implements Comparable,
@Override
public String toString() {
- if (null != string) {
- return string;
- }
-
Writer buffer = new StringBuilderWriter(calcInitialCapacity());
try {
writeTo(buffer);
@@ -160,7 +155,7 @@ public abstract class GString extends GroovyObjectSupport implements Comparable,
throw new StringWriterIOException(e);
}
- return (string = buffer.toString());
+ return buffer.toString();
}
private int calcInitialCapacity() {