Skip to content

Commit c4ca019

Browse files
authored
[MRESOLVER-632][MRESOLVER-640] Remove unneded error cases (#620)
Remove unneded error cases, as this is only about "beutify". Remove running numbers from web page as well. --- https://issues.apache.org/jira/browse/MRESOLVER-632 https://issues.apache.org/jira/browse/MRESOLVER-640
1 parent 77e9b91 commit c4ca019

File tree

3 files changed

+148
-151
lines changed

3 files changed

+148
-151
lines changed

maven-resolver-tools/src/main/java/org/eclipse/aether/tools/CollectConfiguration.java

+18-21
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.nio.file.Path;
2929
import java.nio.file.Paths;
3030
import java.util.ArrayList;
31-
import java.util.Collections;
3231
import java.util.Comparator;
3332
import java.util.HashMap;
3433
import java.util.List;
@@ -71,7 +70,7 @@ public static void main(String[] args) {
7170

7271
protected static final String KEY = "key";
7372

74-
enum Mode {
73+
public enum Mode {
7574
maven,
7675
resolver
7776
}
@@ -125,7 +124,7 @@ public Integer call() {
125124
}
126125
}
127126

128-
Collections.sort(discoveredKeys, Comparator.comparing(e -> e.get(KEY)));
127+
discoveredKeys.sort(Comparator.comparing(e -> e.get(KEY)));
129128

130129
Properties properties = new Properties();
131130
properties.setProperty("resource.loaders", "classpath");
@@ -194,24 +193,22 @@ public void visitEnd() {
194193
.getFullText()
195194
.replace("*", "\\*");
196195
String since = getSince(f);
197-
String source =
198-
switch ((values.get("source") != null
199-
? (String) values.get("source")
200-
: "USER_PROPERTIES") // TODO: enum
201-
.toLowerCase()) {
202-
case "model" -> "Model properties";
203-
case "user_properties" -> "User properties";
204-
default -> throw new IllegalStateException();
205-
};
206-
String type =
207-
switch ((values.get("type") != null
208-
? (String) values.get("type")
209-
: "java.lang.String")) {
210-
case "java.lang.String" -> "String";
211-
case "java.lang.Integer" -> "Integer";
212-
case "java.lang.Boolean" -> "Boolean";
213-
default -> throw new IllegalStateException();
214-
};
196+
String source = (values.get("source") != null
197+
? (String) values.get("source")
198+
: "USER_PROPERTIES") // TODO: enum
199+
.toLowerCase();
200+
source = switch (source) {
201+
case "model" -> "Model properties";
202+
case "user_properties" -> "User properties";
203+
default -> source;};
204+
String type = (values.get("type") != null
205+
? (String) values.get("type")
206+
: "java.lang.String");
207+
if (type.startsWith("java.lang.")) {
208+
type = type.substring("java.lang.".length());
209+
} else if (type.startsWith("java.util.")) {
210+
type = type.substring("java.util.".length());
211+
}
215212
discoveredKeys.add(Map.of(
216213
KEY,
217214
fieldValue.toString(),

maven-resolver-tools/src/main/resources/configuration.md.vm

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ under the License.
4343
#if ($val) `$val` #else - #end
4444
#end
4545

46-
| No | Key | Type | Description | Default Value | Since | Supports Repo ID suffix | Source |
47-
| --- | --- | --- | --- | --- | --- | --- | --- |
46+
| Key | Type | Description | Default Value | Since | Supports Repo ID suffix | Source |
47+
| --- | --- | --- | --- | --- | --- | --- |
4848
#foreach($key in $keys)
49-
| $foreach.count. | `$key.key` | `$key.configurationType` | $key.description | #value( $key.defaultValue ) | $key.since | $key.supportRepoIdSuffix | $key.configurationSource |
49+
| `$key.key` | `$key.configurationType` | $key.description | #value( $key.defaultValue ) | $key.since | $key.supportRepoIdSuffix | $key.configurationSource |
5050
#end
5151

5252
#[[

0 commit comments

Comments
 (0)