Add explicit cast from `Yaml#load(String)`.

The version of SnakeYAML used in 1.12 land doesn't use a generic type
parameter for the return value of `Yaml#load(String)`, so we have to do
it manually on these old builds.
This commit is contained in:
Andreas Troelsen 2021-05-09 13:48:17 +02:00
parent 6a5de71fe4
commit 61d2def32d
2 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ public class FormulaMacros {
String content = new String(bytes);
Yaml yaml = new Yaml();
Map<?, ?> raw = yaml.load(content);
Map<?, ?> raw = (Map<?, ?>) yaml.load(content);
Map<String, Map<String, String>> converted = convert(raw);
macros.clear();

View File

@ -65,7 +65,7 @@ class SignDataMigrator {
@SuppressWarnings("unchecked")
private List<Map<String, ?>> loadSignsInLegacyFile() throws IOException {
byte[] bytes = Files.readAllBytes(legacyFile);
Map<String, ?> map = yaml.load(new String(bytes));
Map<String, ?> map = (Map<String, ?>) yaml.load(new String(bytes));
if (map != null && map.containsKey("signs")) {
List<Map<String, ?>> signs = (List<Map<String, ?>>) map.get("signs");
if (signs != null) {