Skip to content

Commit

Permalink
✨ 小优化,按类名排序
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunMengLu committed Jun 3, 2024
1 parent 1c7b1c1 commit 868e937
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ allprojects {

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
options.compilerArgs << "-parameters" << "-Xlint:unchecked" << "-Xlint:deprecation"
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=2.3.4
VERSION=2.3.5
GROUPID=net.dreamlu

NEXUS_OSS_USER_NAME=***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ protected static void writeFactoriesFile(MultiSetMap<String, String> factories,
writer.write(key);
writer.write("=\\\n ");
StringJoiner joiner = new StringJoiner(",\\\n ");
for (String value : values) {
List<String> valueList = new ArrayList<>(values);
Collections.sort(valueList);
for (String value : valueList) {
joiner.add(value);
}
writer.write(joiner.toString());
Expand Down Expand Up @@ -147,7 +149,9 @@ protected static void writeDevToolsFile(String projectName,
protected static void writeAutoConfigurationImportsFile(Set<String> allAutoConfigurationImports, OutputStream output) throws IOException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, UTF_8));
StringJoiner joiner = new StringJoiner("\n");
for (String configurationImport : allAutoConfigurationImports) {
List<String> configurationImportList = new ArrayList<>(allAutoConfigurationImports);
Collections.sort(configurationImportList);
for (String configurationImport : configurationImportList) {
joiner.add(configurationImport);
}
writer.write(joiner.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.*;

/**
* A helper class for reading and writing Services files.
Expand Down Expand Up @@ -77,7 +74,9 @@ protected static Set<String> readServiceFile(FileObject fileObject, Elements ele
*/
protected static void writeServiceFile(Collection<String> services, OutputStream output) throws IOException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, UTF_8));
for (String service : services) {
List<String> serviceList = new ArrayList<>(services);
Collections.sort(serviceList);
for (String service : serviceList) {
writer.write(service);
writer.newLine();
}
Expand Down

0 comments on commit 868e937

Please sign in to comment.