michael-o commented on code in PR #984:
URL: https://github.com/apache/maven/pull/984#discussion_r1099101256
##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -175,6 +175,8 @@ public class MavenCli {
private CLIManager cliManager;
+ private static final Pattern NEXT_LINE =
Pattern.compile("(\r\n)|(\r)|(\n)");
Review Comment:
The capturing groups are redudant and we likely don't care about Mac classic
LS. `\r?\n` is more than enough.
##########
maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java:
##########
@@ -43,6 +44,10 @@
@Singleton
public class JdkVersionProfileActivator implements ProfileActivator {
+ private static final Pattern FILTER_1 = Pattern.compile("[^0-9\\.\\-\\_]");
+ private static final Pattern FILTER_2 = Pattern.compile("[\\.\\-\\_]");
Review Comment:
I bet the underscore does not require any escaping.
##########
maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java:
##########
@@ -49,6 +50,8 @@ public class PluginDescriptor extends ComponentSetDescriptor
implements Cloneabl
private static final String LIFECYCLE_DESCRIPTOR =
"META-INF/maven/lifecycle.xml";
+ private static final Pattern PATTERN_FILTER_1 =
Pattern.compile("(-?maven-?)|(-?plugin-?)");
Review Comment:
Why so complex? `-?(maven|plugin)-?`, no?
##########
maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java:
##########
@@ -42,11 +43,10 @@
@Singleton
public class DefaultSettingsValidator implements SettingsValidator {
- private static final String ID_REGEX = "[A-Za-z0-9_\\-.]+";
+ private static final String ID = "[A-Za-z0-9_\\-.]+";
Review Comment:
Here, the dot isn't escaped, a few classes it wasn't. As far as I remember
the dot has no special meeting in ranges.
##########
maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java:
##########
@@ -42,11 +43,10 @@
@Singleton
public class DefaultSettingsValidator implements SettingsValidator {
- private static final String ID_REGEX = "[A-Za-z0-9_\\-.]+";
+ private static final String ID = "[A-Za-z0-9_\\-.]+";
Review Comment:
You can simplify with `\w`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]