Skip to content

Commit

Permalink
code simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Mar 24, 2024
1 parent e97ba77 commit e5e3dd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
Expand Up @@ -23,7 +23,6 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

Expand Down Expand Up @@ -85,13 +84,7 @@ public static String[] findSources(String basedir, String include, String exclud
*/
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));
}
}

Expand All @@ -104,13 +97,7 @@ public int compare(MojoDescriptor mojo0, MojoDescriptor mojo1) {
*/
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));
}
}

Expand Down
Expand Up @@ -33,6 +33,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -178,9 +179,9 @@ static String decodeJavadocTags(String description) {
while (matcher.find()) {
String tag = matcher.group(1);
String text = matcher.group(2);
text = StringUtils.replace(text, "&", "&amp;");
text = StringUtils.replace(text, "<", "&lt;");
text = StringUtils.replace(text, ">", "&gt;");
text = text.replace("&", "&amp;");
text = text.replace("<", "&lt;");
text = text.replace(">", "&gt;");
if ("code".equals(tag)) {
text = "<code>" + text + "</code>";
} else if ("link".equals(tag) || "linkplain".equals(tag) || "value".equals(tag)) {
Expand Down Expand Up @@ -516,7 +517,7 @@ public static String discoverPackageName(PluginDescriptor pluginDescriptor) {
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) {
Expand Down

0 comments on commit e5e3dd2

Please sign in to comment.