Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRESOLVER-632][MRESOLVER-640] Remove unneded error cases #620

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -71,7 +70,7 @@ public static void main(String[] args) {

protected static final String KEY = "key";

enum Mode {
public enum Mode {
maven,
resolver
}
Expand Down Expand Up @@ -125,7 +124,7 @@ public Integer call() {
}
}

Collections.sort(discoveredKeys, Comparator.comparing(e -> e.get(KEY)));
discoveredKeys.sort(Comparator.comparing(e -> e.get(KEY)));

Properties properties = new Properties();
properties.setProperty("resource.loaders", "classpath");
Expand Down Expand Up @@ -194,24 +193,22 @@ public void visitEnd() {
.getFullText()
.replace("*", "\\*");
String since = getSince(f);
String source =
switch ((values.get("source") != null
? (String) values.get("source")
: "USER_PROPERTIES") // TODO: enum
.toLowerCase()) {
case "model" -> "Model properties";
case "user_properties" -> "User properties";
default -> throw new IllegalStateException();
};
String type =
switch ((values.get("type") != null
? (String) values.get("type")
: "java.lang.String")) {
case "java.lang.String" -> "String";
case "java.lang.Integer" -> "Integer";
case "java.lang.Boolean" -> "Boolean";
default -> throw new IllegalStateException();
};
String source = (values.get("source") != null
? (String) values.get("source")
: "USER_PROPERTIES") // TODO: enum
.toLowerCase();
source = switch (source) {
case "model" -> "Model properties";
case "user_properties" -> "User properties";
default -> source;};
String type = (values.get("type") != null
? (String) values.get("type")
: "java.lang.String");
if (type.startsWith("java.lang.")) {
type = type.substring("java.lang.".length());
} else if (type.startsWith("java.util.")) {
type = type.substring("java.util.".length());
}
discoveredKeys.add(Map.of(
KEY,
fieldValue.toString(),
Expand Down
6 changes: 3 additions & 3 deletions maven-resolver-tools/src/main/resources/configuration.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ under the License.
#if ($val) `$val` #else - #end
#end

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

#[[
Expand Down
Loading
Loading