Thanks. Another small perf patch below -- maybe we can combine. Avoids a
StringBuilder allocation:
--- a/src/java.base/share/classes/java/util/regex/Matcher.java
+++ b/src/java.base/share/classes/java/util/regex/Matcher.java
@@ -993,13 +993,11 @@
public Matcher appendReplacement(StringBuilder sb, String replacement) {
// If no match, return error
if (first < 0)
throw new IllegalStateException("No match available");
- StringBuilder result = new StringBuilder();
- appendExpandedReplacement(replacement, result);
// Append the intervening text
sb.append(text, lastAppendPosition, first);
// Append the match substitution
+ appendExpandedReplacement(replacement, sb);
- sb.append(result);
On Mon, Apr 23, 2018 at 4:31 PM, Xueming Shen <[email protected]>
wrote:
> this looks fine.
>
> -sherman