TabooLib v4.58
+ 修复 SimpleVersionControl 的一些问题
This commit is contained in:
parent
2bcc82aa15
commit
a83ba2a0d5
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>me.skymc</groupId>
|
||||
<artifactId>TabooLib</artifactId>
|
||||
<version>4.57</version>
|
||||
<version>4.58</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -24,22 +24,27 @@ public class SimpleClassVisitor extends ClassVisitor {
|
||||
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
super.visit(version, access, name, translate(signature), translate(superName), translate(interfaces));
|
||||
super.visit(version, access, translate(name), translate(signature), translate(superName), translate(interfaces));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClass(String name, String outerName, String innerName, int access) {
|
||||
super.visitInnerClass(name, translate(outerName), translate(innerName), access);
|
||||
super.visitInnerClass(translate(name), translate(outerName), translate(innerName), access);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
|
||||
return super.visitField(access, name, translate(descriptor), translate(signature), value);
|
||||
return super.visitField(access, translate(name), translate(descriptor), translate(signature), value instanceof String ? translate((String) value) : value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(String owner, String name, String descriptor) {
|
||||
super.visitOuterClass(translate(owner), translate(name), translate(descriptor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
return new SimpleMethodVisitor(simpleVersionControl, super.visitMethod(access, name, translate(descriptor), translate(signature), translate(exceptions)));
|
||||
return new SimpleMethodVisitor(simpleVersionControl, super.visitMethod(access, translate(name), translate(descriptor), translate(signature), translate(exceptions)));
|
||||
}
|
||||
|
||||
private String translate(String target) {
|
||||
|
@ -1,8 +1,6 @@
|
||||
package me.skymc.taboolib.common.versioncontrol;
|
||||
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.*;
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@ -21,6 +19,11 @@ public class SimpleMethodVisitor extends MethodVisitor {
|
||||
this.simpleVersionControl = simpleVersionControl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitParameter(String name, int access) {
|
||||
super.visitParameter(translate(name), access);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String descriptor) {
|
||||
super.visitMethodInsn(opcode, translate(owner), translate(name), translate(descriptor));
|
||||
@ -33,7 +36,11 @@ public class SimpleMethodVisitor extends MethodVisitor {
|
||||
|
||||
@Override
|
||||
public void visitLdcInsn(Object value) {
|
||||
super.visitLdcInsn(value instanceof String ? translate((String) value) : value);
|
||||
if (value instanceof Type) {
|
||||
super.visitLdcInsn(Type.getType(translate(((Type) value).getDescriptor())));
|
||||
} else {
|
||||
super.visitLdcInsn(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,7 +50,7 @@ public class SimpleMethodVisitor extends MethodVisitor {
|
||||
|
||||
@Override
|
||||
public void visitFieldInsn(int opcode, String owner, String name, String descriptor) {
|
||||
super.visitFieldInsn(opcode, translate(owner), name, translate(descriptor));
|
||||
super.visitFieldInsn(opcode, translate(owner), translate(name), translate(descriptor));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,6 +58,11 @@ public class SimpleMethodVisitor extends MethodVisitor {
|
||||
super.visitLocalVariable(translate(name), translate(descriptor), translate(signature), start, end, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInvokeDynamicInsn(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) {
|
||||
super.visitInvokeDynamicInsn(translate(name), translate(descriptor), bootstrapMethodHandle, bootstrapMethodArguments);
|
||||
}
|
||||
|
||||
private String translate(String target) {
|
||||
return target == null ? null : simpleVersionControl.replace(target);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user