You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2023/02/07 14:07:02 UTC

[GitHub] [maven] gnodet commented on a diff in pull request #984: Speedup by removing non pattern replaceAll with constant arg

gnodet commented on code in PR #984:
URL: https://github.com/apache/maven/pull/984#discussion_r1098702935


##########
maven-model-transform/src/main/java/org/apache/maven/model/transform/ParentXMLFilter.java:
##########
@@ -47,6 +48,8 @@ class ParentXMLFilter extends NodeBufferingParser {
 
     private final Path projectPath;
 
+    public static final Pattern S_FILTER = Pattern.compile("\\s+");

Review Comment:
   `protected` at least



##########
maven-core/src/main/java/org/apache/maven/internal/MultilineMessageHelper.java:
##########
@@ -29,6 +30,8 @@ public class MultilineMessageHelper {
     private static final int DEFAULT_MAX_SIZE = 65;
     private static final char BOX_CHAR = '*';
 
+    public static final Pattern S_FILTER = Pattern.compile("\\s+");

Review Comment:
   This should be private as it's not an internal detail.



##########
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4.java:
##########
@@ -164,7 +164,7 @@ public Object evaluate(String expr, Class<?> type) throws ExpressionEvaluationEx
 
             // Was not an expression
             if (expression.contains("$$")) {

Review Comment:
   I think we should replace those 5 lines with the simple call:
   ```
   return expression.replace("$$", "$");
   ```
   as the `String.replace()` method should exit fast if the searched string can not be found.
   



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

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