From de5ff81e020b25289c2eba8f245d46118e3c799f Mon Sep 17 00:00:00 2001 From: Daniel Sun Date: Wed, 15 Jan 2025 00:49:59 +0900 Subject: [PATCH] Revert "Simplify constructing chars" This reverts commit d0d878c64ba228e5146f06bd0b94f53128162ab1. --- .../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 d234d48c65b..f4d431b53cd 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 static String replaceHexEscapes(String text) { 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 + ((char) Integer.parseInt(_2, 16)); + return _1 + new String(Character.toChars(Integer.parseInt(_2, 16))); }); } @@ -68,7 +68,7 @@ public static String replaceOctalEscapes(String text) { 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 + ((char) Integer.parseInt(_2, 8)); + return _1 + new String(Character.toChars(Integer.parseInt(_2, 8))); }); }