mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Лишний if.
This commit is contained in:
parent
adefda970e
commit
dab4b21ae7
1 changed files with 3 additions and 7 deletions
|
@ -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<String, Object> 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<Enum>) value -> NodeUtils.makeValueEnumGetter(value));
|
||||
}
|
||||
|
||||
private static Serializer<?> serializerClass(int opcode) {
|
||||
|
@ -159,7 +161,7 @@ private interface Serializer<T> {
|
|||
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<Class<?>, 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<List> {
|
||||
|
||||
@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<Map> {
|
||||
|
||||
@Override
|
||||
public InsnList serialize(Map value) {
|
||||
InsnList insnList = new InsnList();
|
||||
|
|
Loading…
Reference in a new issue