Dynamic ASM API

This commit is contained in:
Nico Mexis 2021-07-16 20:26:41 +02:00
parent f0854e4c5f
commit 78c6aac941
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78
6 changed files with 14 additions and 11 deletions

View file

@ -1,5 +1,6 @@
package the.bytecode.club.bytecodeviewer;
import org.objectweb.asm.Opcodes;
import the.bytecode.club.bytecodeviewer.resources.ResourceType;
import java.io.File;
@ -38,6 +39,7 @@ public class Constants
public static String krakatauWorkingDirectory = getBCVDirectory() + fs + "krakatau_" + krakatauVersion;
public static String enjarifyWorkingDirectory = getBCVDirectory() + fs + "enjarify_" + enjarifyVersion;
public static final String[] SUPPORTED_FILE_EXTENSIONS = ResourceType.supportedBCVExtensionMap.keySet().toArray(new String[0]);
public static final int ASM_VERSION = Opcodes.ASM9;
public static final PrintStream ERR = System.err;
public static final PrintStream OUT = System.out;

View file

@ -31,8 +31,8 @@
package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.Remapper;
import the.bytecode.club.bytecodeviewer.Constants;
/**
* An {@link AnnotationVisitor} adapter for type remapping.
@ -45,7 +45,7 @@ public class RemappingAnnotationAdapter extends AnnotationVisitor {
public RemappingAnnotationAdapter(final AnnotationVisitor av,
final org.objectweb.asm.commons.Remapper remapper) {
this(Opcodes.ASM5, av, remapper);
this(Constants.ASM_VERSION, av, remapper);
}
protected RemappingAnnotationAdapter(final int api,

View file

@ -34,8 +34,8 @@ import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.TypePath;
import the.bytecode.club.bytecodeviewer.Constants;
/**
* A {@link ClassVisitor} for type remapping.
@ -49,7 +49,7 @@ public class RemappingClassAdapter extends ClassVisitor {
protected String className;
public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) {
this(Opcodes.ASM5, cv, remapper);
this(Constants.ASM_VERSION, cv, remapper);
}
protected RemappingClassAdapter(final int api, final ClassVisitor cv,

View file

@ -32,9 +32,9 @@ package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.TypePath;
import org.objectweb.asm.commons.Remapper;
import the.bytecode.club.bytecodeviewer.Constants;
/**
* A {@link FieldVisitor} adapter for type remapping.
@ -46,7 +46,7 @@ public class RemappingFieldAdapter extends FieldVisitor {
private final org.objectweb.asm.commons.Remapper remapper;
public RemappingFieldAdapter(final FieldVisitor fv, final org.objectweb.asm.commons.Remapper remapper) {
this(Opcodes.ASM5, fv, remapper);
this(Constants.ASM_VERSION, fv, remapper);
}
protected RemappingFieldAdapter(final int api, final FieldVisitor fv,

View file

@ -38,6 +38,7 @@ import org.objectweb.asm.Opcodes;
import org.objectweb.asm.TypePath;
import org.objectweb.asm.commons.LocalVariablesSorter;
import org.objectweb.asm.commons.Remapper;
import the.bytecode.club.bytecodeviewer.Constants;
/**
* A {@link LocalVariablesSorter} for type mapping.
@ -50,7 +51,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
public RemappingMethodAdapter(final int access, final String desc,
final MethodVisitor mv, final org.objectweb.asm.commons.Remapper remapper) {
this(Opcodes.ASM5, access, desc, mv, remapper);
this(Constants.ASM_VERSION, access, desc, mv, remapper);
}
protected RemappingMethodAdapter(final int api, final int access,
@ -125,7 +126,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
@Override
public void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc) {
if (api >= Opcodes.ASM5) {
if (api >= Constants.ASM_VERSION) {
super.visitMethodInsn(opcode, owner, name, desc);
return;
}
@ -136,7 +137,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
@Override
public void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc, final boolean itf) {
if (api < Opcodes.ASM5) {
if (api < Constants.ASM_VERSION) {
super.visitMethodInsn(opcode, owner, name, desc, itf);
return;
}

View file

@ -30,9 +30,9 @@
package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.Remapper;
import org.objectweb.asm.signature.SignatureVisitor;
import the.bytecode.club.bytecodeviewer.Constants;
/**
* A {@link SignatureVisitor} adapter for type mapping.
@ -49,7 +49,7 @@ public class RemappingSignatureAdapter extends SignatureVisitor {
public RemappingSignatureAdapter(final SignatureVisitor v,
final org.objectweb.asm.commons.Remapper remapper) {
this(Opcodes.ASM5, v, remapper);
this(Constants.ASM_VERSION, v, remapper);
}
protected RemappingSignatureAdapter(final int api,