You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2020/07/12 23:07:51 UTC

[GitHub] [groovy] danielsun1106 commented on a change in pull request #1309: GROOVY-9637: Improve the performance of GString

danielsun1106 commented on a change in pull request #1309:
URL: https://github.com/apache/groovy/pull/1309#discussion_r453374407



##########
File path: src/main/java/groovy/lang/GString.java
##########
@@ -276,4 +309,16 @@ public Pattern negate() {
     public byte[] getBytes(String charset) throws UnsupportedEncodingException {
         return toString().getBytes(charset);
     }
+
+    private boolean checkValuesImmutable() {
+        for (Object value : values) {
+            if (null == value) continue;
+            if (!(IMMUTABLE_TYPE_LIST.contains(value.getClass())

Review comment:
       enum's `toString` may return different string literal for each time they are called, e.g.
   ```groovy
   enum Color {
       RED, GREEN, BLUE
       
       String toString() {
           return "${new Date()}"
       }
   }
   println Color.RED
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org