* AsmFix P1

* ASMFix P2 или как asm 7 тупит.
This commit is contained in:
Zaxar163 2019-01-03 11:27:08 +03:00 committed by GitHub
parent 8d34ae76fc
commit 3d8700d727
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -23,7 +23,7 @@ private class CheckSuperClassVisitor extends ClassVisitor {
String superClassName;
public CheckSuperClassVisitor() {
super(Opcodes.ASM5);
super(Opcodes.ASM7);
}
@Override
@ -57,10 +57,13 @@ public void acceptVisitor(String className, ClassVisitor visitor) throws IOExcep
public byte[] getClassData(String className) throws IOException {
for (JarFile f : cp) {
if (f.getEntry(className + ".class") != null)
if (f.getEntry(className + ".class") != null) {
byte[] bytes = null;
try (InputStream in = f.getInputStream(f.getEntry(className + ".class"))) {
return IOHelper.read(in);
bytes = IOHelper.read(in);
}
return bytes;
}
}
return IOHelper.read(IOHelper.getResourceURL(className + ".class"));
}

View file

@ -33,7 +33,7 @@ public byte[] transform(byte[] input, String classname, JARLauncherBinary data)
ClassNode cn = new ClassNode();
cr.accept(cn, ClassReader.SKIP_DEBUG);
for (ClassNodeTransformer tr : transLst) tr.transform(cn, classname, data);
ClassWriter cw = new SafeClassWriter(data.reader, ClassWriter.COMPUTE_FRAMES);
ClassWriter cw = new SafeClassWriter(data.reader, ClassWriter.COMPUTE_MAXS);
cn.accept(cw);
return cw.toByteArray();
}