Upgrade to asm 7.0

This commit is contained in:
yushijinhun 2018-12-31 14:43:20 +08:00
parent ead8866a40
commit 146c029779
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4
6 changed files with 15 additions and 15 deletions

View file

@ -9,7 +9,7 @@ repositories {
} }
dependencies { dependencies {
compile 'org.ow2.asm:asm:6.2.1' compile 'org.ow2.asm:asm:7.0'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }

View file

@ -1,6 +1,6 @@
package moe.yushi.authlibinjector.transform; package moe.yushi.authlibinjector.transform;
import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.ASM7;
import static org.objectweb.asm.Opcodes.INVOKESTATIC; import static org.objectweb.asm.Opcodes.INVOKESTATIC;
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
@ -203,7 +203,7 @@ public class AuthlibLogInterceptor implements TransformUnit {
return Optional.empty(); return Optional.empty();
} }
} }
return Optional.of(new ClassVisitor(ASM6, writer) { return Optional.of(new ClassVisitor(ASM7, writer) {
@Override @Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {

View file

@ -1,6 +1,6 @@
package moe.yushi.authlibinjector.transform; package moe.yushi.authlibinjector.transform;
import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.ASM7;
import java.util.Optional; import java.util.Optional;
import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.MethodVisitor;
@ -9,11 +9,11 @@ public abstract class LdcTransformUnit implements TransformUnit {
@Override @Override
public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) { public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) {
return Optional.of(new ClassVisitor(ASM6, writer) { return Optional.of(new ClassVisitor(ASM7, writer) {
@Override @Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return new MethodVisitor(ASM6, super.visitMethod(access, name, desc, signature, exceptions)) { return new MethodVisitor(ASM7, super.visitMethod(access, name, desc, signature, exceptions)) {
@Override @Override
public void visitLdcInsn(Object cst) { public void visitLdcInsn(Object cst) {

View file

@ -2,7 +2,7 @@ package moe.yushi.authlibinjector.transform;
import static org.objectweb.asm.Opcodes.AASTORE; import static org.objectweb.asm.Opcodes.AASTORE;
import static org.objectweb.asm.Opcodes.ANEWARRAY; import static org.objectweb.asm.Opcodes.ANEWARRAY;
import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.ASM7;
import static org.objectweb.asm.Opcodes.DUP; import static org.objectweb.asm.Opcodes.DUP;
import static org.objectweb.asm.Opcodes.ICONST_0; import static org.objectweb.asm.Opcodes.ICONST_0;
import static org.objectweb.asm.Opcodes.ICONST_1; import static org.objectweb.asm.Opcodes.ICONST_1;
@ -23,12 +23,12 @@ public class SkinWhitelistTransformUnit implements TransformUnit {
@Override @Override
public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) { public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) {
if ("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService".equals(className)) { if ("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService".equals(className)) {
return Optional.of(new ClassVisitor(ASM6, writer) { return Optional.of(new ClassVisitor(ASM7, writer) {
@Override @Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if ("<clinit>".equals(name)) { if ("<clinit>".equals(name)) {
return new MethodVisitor(ASM6, super.visitMethod(access, name, desc, signature, exceptions)) { return new MethodVisitor(ASM7, super.visitMethod(access, name, desc, signature, exceptions)) {
int status = 0; int status = 0;

View file

@ -4,7 +4,7 @@ import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_STATIC; import static org.objectweb.asm.Opcodes.ACC_STATIC;
import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC; import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC;
import static org.objectweb.asm.Opcodes.ALOAD; import static org.objectweb.asm.Opcodes.ALOAD;
import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.ASM7;
import static org.objectweb.asm.Opcodes.ASTORE; import static org.objectweb.asm.Opcodes.ASTORE;
import static org.objectweb.asm.Opcodes.CHECKCAST; import static org.objectweb.asm.Opcodes.CHECKCAST;
import static org.objectweb.asm.Opcodes.F_APPEND; import static org.objectweb.asm.Opcodes.F_APPEND;
@ -40,7 +40,7 @@ public class YggdrasilKeyTransformUnit implements TransformUnit {
@Override @Override
public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) { public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) {
if ("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService".equals(className)) { if ("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService".equals(className)) {
return Optional.of(new ClassVisitor(ASM6, writer) { return Optional.of(new ClassVisitor(ASM7, writer) {
@Override @Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
@ -94,7 +94,7 @@ public class YggdrasilKeyTransformUnit implements TransformUnit {
@Override @Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return new MethodVisitor(ASM6, super.visitMethod(access, name, desc, signature, exceptions)) { return new MethodVisitor(ASM7, super.visitMethod(access, name, desc, signature, exceptions)) {
@Override @Override
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) { public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
if (opcode == INVOKEVIRTUAL if (opcode == INVOKEVIRTUAL

View file

@ -1,7 +1,7 @@
package moe.yushi.authlibinjector.transform.support; package moe.yushi.authlibinjector.transform.support;
import static org.objectweb.asm.Opcodes.ALOAD; import static org.objectweb.asm.Opcodes.ALOAD;
import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.ASM7;
import static org.objectweb.asm.Opcodes.F_SAME; import static org.objectweb.asm.Opcodes.F_SAME;
import static org.objectweb.asm.Opcodes.GETFIELD; import static org.objectweb.asm.Opcodes.GETFIELD;
import static org.objectweb.asm.Opcodes.IFEQ; import static org.objectweb.asm.Opcodes.IFEQ;
@ -28,12 +28,12 @@ public class CitizensTransformer implements TransformUnit {
@Override @Override
public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) { public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, Runnable modifiedCallback) {
if ("net.citizensnpcs.Settings$Setting".equals(className)) { if ("net.citizensnpcs.Settings$Setting".equals(className)) {
return Optional.of(new ClassVisitor(ASM6, writer) { return Optional.of(new ClassVisitor(ASM7, writer) {
@Override @Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
if (("loadFromKey".equals(name) || "setAtKey".equals(name)) if (("loadFromKey".equals(name) || "setAtKey".equals(name))
&& "(Lnet/citizensnpcs/api/util/DataKey;)V".equals(descriptor)) { && "(Lnet/citizensnpcs/api/util/DataKey;)V".equals(descriptor)) {
return new MethodVisitor(ASM6, super.visitMethod(access, name, descriptor, signature, exceptions)) { return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) {
@Override @Override
public void visitCode() { public void visitCode() {
super.visitCode(); super.visitCode();