Add explicit cast from Yaml#load(String).

The version of SnakeYAML used in 1.8 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:50:46 +02:00
parent b2194480a9
commit c500a17214
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) {