diff --git a/build.gradle b/build.gradle index 0f00673..7a23d4c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.github.johnrengelman.shadow' version '6.0.0' + id 'com.github.johnrengelman.shadow' version '6.1.0' id 'com.palantir.git-version' version '0.12.3' id 'java' } @@ -9,8 +9,8 @@ repositories { } dependencies { - implementation 'org.ow2.asm:asm:8.0.1' - testImplementation 'junit:junit:4.13' + implementation 'org.ow2.asm:asm:9.1' + testImplementation 'junit:junit:4.13.2' } sourceCompatibility = 8 diff --git a/src/main/java/moe/yushi/authlibinjector/transform/CallbackMetafactoryTransformer.java b/src/main/java/moe/yushi/authlibinjector/transform/CallbackMetafactoryTransformer.java index 3dd2f1f..6107155 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/CallbackMetafactoryTransformer.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/CallbackMetafactoryTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -21,7 +21,7 @@ import static org.objectweb.asm.Opcodes.ACC_STATIC; import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC; import static org.objectweb.asm.Opcodes.ALOAD; import static org.objectweb.asm.Opcodes.ARETURN; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.DUP; import static org.objectweb.asm.Opcodes.INVOKESPECIAL; import static org.objectweb.asm.Opcodes.INVOKESTATIC; @@ -35,7 +35,7 @@ class CallbackMetafactoryTransformer implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext context) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { super.visit(version, access, name, signature, superName, interfaces); diff --git a/src/main/java/moe/yushi/authlibinjector/transform/CallbackSupport.java b/src/main/java/moe/yushi/authlibinjector/transform/CallbackSupport.java index 96d4f18..917ca34 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/CallbackSupport.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/CallbackSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/src/main/java/moe/yushi/authlibinjector/transform/ClassVersionTransformUnit.java b/src/main/java/moe/yushi/authlibinjector/transform/ClassVersionTransformUnit.java index 50ce016..f916ba8 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/ClassVersionTransformUnit.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/ClassVersionTransformUnit.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -18,7 +18,7 @@ package moe.yushi.authlibinjector.transform; import static moe.yushi.authlibinjector.util.Logging.log; import static moe.yushi.authlibinjector.util.Logging.Level.DEBUG; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import java.util.Optional; import org.objectweb.asm.ClassVisitor; @@ -34,7 +34,7 @@ class ClassVersionTransformUnit implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext context) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { int major = version & 0xffff; diff --git a/src/main/java/moe/yushi/authlibinjector/transform/LdcTransformUnit.java b/src/main/java/moe/yushi/authlibinjector/transform/LdcTransformUnit.java index 50d6726..143e96b 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/LdcTransformUnit.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/LdcTransformUnit.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ */ package moe.yushi.authlibinjector.transform; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import java.util.Optional; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; @@ -25,11 +25,11 @@ public abstract class LdcTransformUnit implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, desc, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, desc, signature, exceptions)) { @Override public void visitLdcInsn(Object cst) { diff --git a/src/main/java/moe/yushi/authlibinjector/transform/support/AuthlibLogInterceptor.java b/src/main/java/moe/yushi/authlibinjector/transform/support/AuthlibLogInterceptor.java index 20109c8..673b691 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/support/AuthlibLogInterceptor.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/support/AuthlibLogInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ package moe.yushi.authlibinjector.transform.support; import static moe.yushi.authlibinjector.util.Logging.log; import static moe.yushi.authlibinjector.util.Logging.Level.INFO; import static moe.yushi.authlibinjector.util.Logging.Level.WARNING; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; import java.lang.annotation.Annotation; import java.lang.reflect.Array; @@ -221,12 +221,12 @@ public class AuthlibLogInterceptor implements TransformUnit { return Optional.empty(); } } - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { if ("".equals(name)) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) { @Override public void visitCode() { super.visitCode(); diff --git a/src/main/java/moe/yushi/authlibinjector/transform/support/CitizensTransformer.java b/src/main/java/moe/yushi/authlibinjector/transform/support/CitizensTransformer.java index 370ba0b..ee5de77 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/support/CitizensTransformer.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/support/CitizensTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -17,7 +17,7 @@ package moe.yushi.authlibinjector.transform.support; import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.F_SAME; import static org.objectweb.asm.Opcodes.GETFIELD; import static org.objectweb.asm.Opcodes.IFEQ; @@ -45,12 +45,12 @@ public class CitizensTransformer implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { if ("net.citizensnpcs.Settings$Setting".equals(className)) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { if (("loadFromKey".equals(name) || "setAtKey".equals(name)) && "(Lnet/citizensnpcs/api/util/DataKey;)V".equals(descriptor)) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) { @Override public void visitCode() { super.visitCode(); diff --git a/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974Workaround.java b/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974Workaround.java index 67928eb..d8c2a34 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974Workaround.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974Workaround.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ package moe.yushi.authlibinjector.transform.support; import static java.util.Collections.unmodifiableSet; import static moe.yushi.authlibinjector.util.Logging.log; import static moe.yushi.authlibinjector.util.Logging.Level.INFO; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.ISTORE; import java.util.Arrays; import java.util.HashSet; @@ -60,11 +60,11 @@ public class MC52974Workaround implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { if ("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService".equals(className)) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { if ("fillGameProfile".equals(name) && "(Lcom/mojang/authlib/GameProfile;Z)Lcom/mojang/authlib/GameProfile;".equals(descriptor)) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) { @Override public void visitCode() { super.visitCode(); diff --git a/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974_1710Workaround.java b/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974_1710Workaround.java index d4e691c..0b6dd92 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974_1710Workaround.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/support/MC52974_1710Workaround.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -20,7 +20,7 @@ import static moe.yushi.authlibinjector.util.Logging.log; import static moe.yushi.authlibinjector.util.Logging.Level.INFO; import static moe.yushi.authlibinjector.util.Logging.Level.WARNING; import static org.objectweb.asm.Opcodes.ARETURN; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.CHECKCAST; import static org.objectweb.asm.Opcodes.DUP; import static org.objectweb.asm.Opcodes.GETFIELD; @@ -107,14 +107,14 @@ public class MC52974_1710Workaround { private static class SessionTransformer implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { - return detectNotchName(className, "bbs", "net.minecraft.util.Session", isNotchName -> new ClassVisitor(ASM7, writer) { + return detectNotchName(className, "bbs", "net.minecraft.util.Session", isNotchName -> new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { if (isNotchName ? "e".equals(name) && "()Lcom/mojang/authlib/GameProfile;".equals(descriptor) : "func_148256_e".equals(name) && "()Lcom/mojang/authlib/GameProfile;".equals(descriptor)) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) { @Override public void visitInsn(int opcode) { if (opcode == ARETURN) { @@ -141,14 +141,14 @@ public class MC52974_1710Workaround { private static class S0CPacketSpawnPlayerTransformer implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { - return detectNotchName(className, "gb", "net.minecraft.network.play.server.S0CPacketSpawnPlayer", isNotchName -> new ClassVisitor(ASM7, writer) { + return detectNotchName(className, "gb", "net.minecraft.network.play.server.S0CPacketSpawnPlayer", isNotchName -> new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { if (isNotchName ? "b".equals(name) && "(Let;)V".equals(descriptor) : "func_148840_b".equals(name) && "(Lnet/minecraft/network/PacketBuffer;)V".equals(descriptor)) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) { @Override public void visitFieldInsn(int opcode, String owner, String name, String descriptor) { super.visitFieldInsn(opcode, owner, name, descriptor); diff --git a/src/main/java/moe/yushi/authlibinjector/transform/support/MainArgumentsTransformer.java b/src/main/java/moe/yushi/authlibinjector/transform/support/MainArgumentsTransformer.java index da09c26..15dd9b2 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/support/MainArgumentsTransformer.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/support/MainArgumentsTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -20,7 +20,7 @@ import static java.util.stream.Collectors.joining; import static moe.yushi.authlibinjector.util.Logging.log; import static moe.yushi.authlibinjector.util.Logging.Level.DEBUG; import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.ASTORE; import java.util.List; import java.util.Optional; @@ -40,11 +40,11 @@ public class MainArgumentsTransformer implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { if ("net.minecraft.client.main.Main".equals(className)) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { if ("main".equals(name) && "([Ljava/lang/String;)V".equals(descriptor)) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) { @Override public void visitCode() { super.visitCode(); diff --git a/src/main/java/moe/yushi/authlibinjector/transform/support/SkinWhitelistTransformUnit.java b/src/main/java/moe/yushi/authlibinjector/transform/support/SkinWhitelistTransformUnit.java index 3afbef8..40abb05 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/support/SkinWhitelistTransformUnit.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/support/SkinWhitelistTransformUnit.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -17,7 +17,7 @@ package moe.yushi.authlibinjector.transform.support; import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.IRETURN; import java.net.URI; import java.net.URISyntaxException; @@ -81,7 +81,7 @@ public class SkinWhitelistTransformUnit implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { if ("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService".equals(className)) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { diff --git a/src/main/java/moe/yushi/authlibinjector/transform/support/YggdrasilKeyTransformUnit.java b/src/main/java/moe/yushi/authlibinjector/transform/support/YggdrasilKeyTransformUnit.java index 0399e41..1092d79 100644 --- a/src/main/java/moe/yushi/authlibinjector/transform/support/YggdrasilKeyTransformUnit.java +++ b/src/main/java/moe/yushi/authlibinjector/transform/support/YggdrasilKeyTransformUnit.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2021 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ */ package moe.yushi.authlibinjector.transform.support; -import static org.objectweb.asm.Opcodes.ASM7; +import static org.objectweb.asm.Opcodes.ASM9; import static org.objectweb.asm.Opcodes.H_INVOKEVIRTUAL; import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; import java.lang.invoke.MethodHandle; @@ -52,10 +52,10 @@ public class YggdrasilKeyTransformUnit implements TransformUnit { @Override public Optional transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext ctx) { if ("com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService".equals(className)) { - return Optional.of(new ClassVisitor(ASM7, writer) { + return Optional.of(new ClassVisitor(ASM9, writer) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - return new MethodVisitor(ASM7, super.visitMethod(access, name, desc, signature, exceptions)) { + return new MethodVisitor(ASM9, super.visitMethod(access, name, desc, signature, exceptions)) { @Override public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) { if (opcode == INVOKEVIRTUAL