From dab4b21ae7d4d3a7678b7e6e8b059f1dd82d8543 Mon Sep 17 00:00:00 2001 From: Zaxar163 Date: Mon, 10 Feb 2020 19:35:48 +0100 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=9B=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?if.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gravit/launchserver/asm/InjectClassAcceptor.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/asm/InjectClassAcceptor.java b/LaunchServer/src/main/java/pro/gravit/launchserver/asm/InjectClassAcceptor.java index fe5da412..66dcd9c8 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/asm/InjectClassAcceptor.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/asm/InjectClassAcceptor.java @@ -14,6 +14,7 @@ import pro.gravit.launcher.LauncherInject; import pro.gravit.launcher.LauncherInjectionConstructor; +@SuppressWarnings("rawtypes") public class InjectClassAcceptor implements MainBuildTask.ASMTransformer { private final Map values; @@ -139,6 +140,7 @@ public void visit(final String name, final Object value) { ret.add(new InsnNode(Opcodes.I2C)); return ret; }); + serializers.put(Enum.class, (Serializer) value -> NodeUtils.makeValueEnumGetter(value)); } private static Serializer serializerClass(int opcode) { @@ -159,7 +161,7 @@ private interface Serializer { InsnList serialize(T value); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings("unchecked") private static InsnList serializeValue(Object value) { if (value == null) { InsnList insnList = new InsnList(); @@ -171,8 +173,6 @@ private static InsnList serializeValue(Object value) { insnList.add(new LdcInsnNode(value)); return insnList; } - if (Enum.class.isInstance(value)) - return NodeUtils.makeValueEnumGetter((Enum)value); for (Map.Entry, Serializer> serializerEntry : serializers.entrySet()) { if (serializerEntry.getKey().isInstance(value)) { return ((Serializer) serializerEntry.getValue()).serialize(value); @@ -182,9 +182,7 @@ private static InsnList serializeValue(Object value) { value.getClass())); } - @SuppressWarnings("rawtypes") private static class ListSerializer implements Serializer { - @Override public InsnList serialize(List value) { InsnList insnList = new InsnList(); @@ -204,9 +202,7 @@ public InsnList serialize(List value) { } } - @SuppressWarnings("rawtypes") private static class MapSerializer implements Serializer { - @Override public InsnList serialize(Map value) { InsnList insnList = new InsnList();