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 2025/01/14 15:24:57 UTC

(groovy) branch master updated: Simplify constructing chars

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new d0d878c64b Simplify constructing chars
d0d878c64b is described below

commit d0d878c64ba228e5146f06bd0b94f53128162ab1
Author: Daniel Sun <su...@apache.org>
AuthorDate: Wed Jan 15 00:24:47 2025 +0900

    Simplify constructing chars
---
 src/main/java/org/apache/groovy/parser/antlr4/util/StringUtils.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/groovy/parser/antlr4/util/StringUtils.java b/src/main/java/org/apache/groovy/parser/antlr4/util/StringUtils.java
index f4d431b53c..d234d48c65 100644
--- a/src/main/java/org/apache/groovy/parser/antlr4/util/StringUtils.java
+++ b/src/main/java/org/apache/groovy/parser/antlr4/util/StringUtils.java
@@ -59,7 +59,7 @@ public class StringUtils {
 		return replaceAll(text, HEX_ESCAPES_PATTERN, m -> {
             final String _0 = m.group(0), _1 = m.group(1), _2 = m.group(2);
             if (isLengthOdd(_1)) return _0;
-            return _1 + new String(Character.toChars(Integer.parseInt(_2, 16)));
+            return _1 + ((char) Integer.parseInt(_2, 16));
         });
 	}
 
@@ -68,7 +68,7 @@ public class StringUtils {
 		return replaceAll(text, OCTAL_ESCAPES_PATTERN, m -> {
             final String _0 = m.group(0), _1 = m.group(1), _2 = m.group(2);
             if (isLengthOdd(_1)) return _0;
-            return _1 + new String(Character.toChars(Integer.parseInt(_2, 8)));
+            return _1 + ((char) Integer.parseInt(_2, 8));
         });
 	}