Skip to content

Commit 186fe1b

Browse files
committed
fix: make sure we retain ordering in app.yml files
1 parent 4d5c3cb commit 186fe1b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/codejive/jpm/config/AppInfo.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import java.nio.file.Files;
77
import java.nio.file.Path;
88
import java.nio.file.Paths;
9+
import java.util.LinkedHashMap;
910
import java.util.Map;
10-
import java.util.TreeMap;
1111
import org.yaml.snakeyaml.DumperOptions;
1212
import org.yaml.snakeyaml.Yaml;
1313

@@ -16,11 +16,11 @@
1616
* from/to files.
1717
*/
1818
public class AppInfo {
19-
private Map<String, Object> yaml = new TreeMap<>();
19+
private Map<String, Object> yaml = new LinkedHashMap<>();
2020

21-
public Map<String, String> dependencies = new TreeMap<>();
22-
public Map<String, String> repositories = new TreeMap<>();
23-
public Map<String, String> actions = new TreeMap<>();
21+
public Map<String, String> dependencies = new LinkedHashMap<>();
22+
public Map<String, String> repositories = new LinkedHashMap<>();
23+
public Map<String, String> actions = new LinkedHashMap<>();
2424

2525
/** The official name of the app.yml file. */
2626
public static final String APP_INFO_FILE = "app.yml";
@@ -72,7 +72,7 @@ public static AppInfo read() throws IOException {
7272
}
7373
// Ensure yaml is never null
7474
if (appInfo.yaml == null) {
75-
appInfo.yaml = new TreeMap<>();
75+
appInfo.yaml = new LinkedHashMap<>();
7676
}
7777
// WARNING awful code ahead
7878
if (appInfo.yaml.containsKey("dependencies")

0 commit comments

Comments
 (0)