From 2fd0039c0133ca4221f64a48719d5d58a3063ccf Mon Sep 17 00:00:00 2001 From: Stefan Bischof Date: Sun, 7 Dec 2025 23:16:28 +0100 Subject: [PATCH] refactor old StringBuffer usage --- .../java/org/eclipse/daanse/olap/api/IdentifierSegment.java | 4 ++-- .../src/main/java/org/eclipse/daanse/olap/common/Util.java | 5 ++--- .../daanse/olap/function/def/crossjoin/CrossJoinTest.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/org/eclipse/daanse/olap/api/IdentifierSegment.java b/api/src/main/java/org/eclipse/daanse/olap/api/IdentifierSegment.java index 2240341..47b134c 100644 --- a/api/src/main/java/org/eclipse/daanse/olap/api/IdentifierSegment.java +++ b/api/src/main/java/org/eclipse/daanse/olap/api/IdentifierSegment.java @@ -70,9 +70,9 @@ public sealed interface IdentifierSegment permits KeyIdentifierSegment, NameIden String toString(); /** - * Appends a string representation of this Segment to a StringBuffer. + * Appends a string representation of this Segment to a StringBuilder. * - * @param buf StringBuffer + * @param buf StringBuilder */ void toString(StringBuilder buf); diff --git a/common/src/main/java/org/eclipse/daanse/olap/common/Util.java b/common/src/main/java/org/eclipse/daanse/olap/common/Util.java index c61daed..bf74b08 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/common/Util.java +++ b/common/src/main/java/org/eclipse/daanse/olap/common/Util.java @@ -2315,9 +2315,8 @@ public static String replaceProperties( String text, Map env) { - // As of JDK 1.5, cannot use StringBuilder - appendReplacement requires - // the antediluvian StringBuffer. - StringBuffer buf = new StringBuffer(text.length() + 200); + // Since Java 9, Matcher.appendReplacement accepts StringBuilder + StringBuilder buf = new StringBuilder(text.length() + 200); Pattern pattern = Pattern.compile("\\$\\{([^${}]+)\\}"); Matcher matcher = pattern.matcher(text); diff --git a/common/src/test/java/org/eclipse/daanse/olap/function/def/crossjoin/CrossJoinTest.java b/common/src/test/java/org/eclipse/daanse/olap/function/def/crossjoin/CrossJoinTest.java index 5a4c19b..28915a9 100644 --- a/common/src/test/java/org/eclipse/daanse/olap/function/def/crossjoin/CrossJoinTest.java +++ b/common/src/test/java/org/eclipse/daanse/olap/function/def/crossjoin/CrossJoinTest.java @@ -338,7 +338,7 @@ protected void doMTupleTupleListTest( // Helper methods //////////////////////////////////////////////////////////////////////// protected String toString( TupleIterable l ) { - StringBuffer buf = new StringBuffer( 100 ); + StringBuilder buf = new StringBuilder( 100 ); buf.append( '{' ); int j = 0; for ( List o : l ) {