[FIX] Фиксы MainBuildTask

This commit is contained in:
Gravit 2020-01-24 10:06:10 +07:00
parent 667fb21e9b
commit 83a3c963d3
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -13,6 +13,7 @@
import pro.gravit.launchserver.asm.ClassMetadataReader;
import pro.gravit.launchserver.asm.ConfigGenerator;
import pro.gravit.launchserver.asm.InjectClassAcceptor;
import pro.gravit.launchserver.asm.SafeClassWriter;
import pro.gravit.launchserver.binary.BuildContext;
import pro.gravit.launchserver.binary.LauncherConfigurator;
import pro.gravit.utils.HookException;
@ -82,7 +83,7 @@ default byte[] transform(byte[] input, String classname, BuildContext context)
ClassNode cn = new ClassNode();
reader.accept(cn, 0);
transform(cn, classname, context);
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
SafeClassWriter writer = new SafeClassWriter(context.task.reader,ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
cn.accept(writer);
return writer.toByteArray();
}
@ -234,7 +235,7 @@ public byte[] transformClass(byte[] bytes, String classname, BuildContext contex
}
else if(cn != null)
{
writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
writer = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
cn.accept(writer);
result = writer.toByteArray();
}
@ -248,7 +249,7 @@ else if(cn != null)
}
if(cn != null)
{
writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
writer = new SafeClassWriter(reader,ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
cn.accept(writer);
result = writer.toByteArray();
}