This is an automated email from the ASF dual-hosted git repository. hboutemy pushed a commit to branch simplifications in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git
commit 36a6152a999348446181eac10efb4de0cd13b66a Author: Hervé Boutemy <hbout...@apache.org> AuthorDate: Sun Mar 24 12:01:08 2024 +0100 code simplifications --- .../org/apache/maven/tools/plugin/util/PluginUtils.java | 17 ++--------------- .../maven/tools/plugin/generator/GeneratorUtils.java | 8 ++++---- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java index 98b764bb..55ea5f9e 100644 --- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java +++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java @@ -23,7 +23,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; -import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -85,13 +84,7 @@ public final class PluginUtils { */ public static void sortMojos(List<MojoDescriptor> mojoDescriptors) { if (mojoDescriptors != null) { - Collections.sort(mojoDescriptors, new Comparator<MojoDescriptor>() { - /** {@inheritDoc} */ - @Override - public int compare(MojoDescriptor mojo0, MojoDescriptor mojo1) { - return mojo0.getGoal().compareToIgnoreCase(mojo1.getGoal()); - } - }); + mojoDescriptors.sort(Comparator.comparing(MojoDescriptor::getGoal)); } } @@ -104,13 +97,7 @@ public final class PluginUtils { */ public static void sortMojoParameters(List<Parameter> parameters) { if (parameters != null) { - Collections.sort(parameters, new Comparator<Parameter>() { - /** {@inheritDoc} */ - @Override - public int compare(Parameter parameter1, Parameter parameter2) { - return parameter1.getName().compareToIgnoreCase(parameter2.getName()); - } - }); + parameters.sort(Comparator.comparing(Parameter::getName)); } } diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java index c9779870..14bdbb20 100644 --- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java +++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java @@ -178,9 +178,9 @@ public final class GeneratorUtils { while (matcher.find()) { String tag = matcher.group(1); String text = matcher.group(2); - text = StringUtils.replace(text, "&", "&"); - text = StringUtils.replace(text, "<", "<"); - text = StringUtils.replace(text, ">", ">"); + text = text.replace("&", "&"); + text = text.replace("<", "<"); + text = text.replace(">", ">"); if ("code".equals(tag)) { text = "<code>" + text + "</code>"; } else if ("link".equals(tag) || "linkplain".equals(tag) || "value".equals(tag)) { @@ -516,7 +516,7 @@ public final class GeneratorUtils { for (MojoDescriptor descriptor : mojoDescriptors) { String impl = descriptor.getImplementation(); - if (StringUtils.equals(descriptor.getGoal(), "help") && StringUtils.equals("HelpMojo", impl)) { + if (Objects.equals(descriptor.getGoal(), "help") && Objects.equals("HelpMojo", impl)) { continue; } if (impl.lastIndexOf('.') != -1) {