Dynamic ASM API
This commit is contained in:
parent
f0854e4c5f
commit
78c6aac941
6 changed files with 14 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
package the.bytecode.club.bytecodeviewer;
|
package the.bytecode.club.bytecodeviewer;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceType;
|
import the.bytecode.club.bytecodeviewer.resources.ResourceType;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -38,6 +39,7 @@ public class Constants
|
||||||
public static String krakatauWorkingDirectory = getBCVDirectory() + fs + "krakatau_" + krakatauVersion;
|
public static String krakatauWorkingDirectory = getBCVDirectory() + fs + "krakatau_" + krakatauVersion;
|
||||||
public static String enjarifyWorkingDirectory = getBCVDirectory() + fs + "enjarify_" + enjarifyVersion;
|
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 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 ERR = System.err;
|
||||||
public static final PrintStream OUT = System.out;
|
public static final PrintStream OUT = System.out;
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
|
package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
|
||||||
|
|
||||||
import org.objectweb.asm.AnnotationVisitor;
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
|
import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An {@link AnnotationVisitor} adapter for type remapping.
|
* An {@link AnnotationVisitor} adapter for type remapping.
|
||||||
|
@ -45,7 +45,7 @@ public class RemappingAnnotationAdapter extends AnnotationVisitor {
|
||||||
|
|
||||||
public RemappingAnnotationAdapter(final AnnotationVisitor av,
|
public RemappingAnnotationAdapter(final AnnotationVisitor av,
|
||||||
final org.objectweb.asm.commons.Remapper remapper) {
|
final org.objectweb.asm.commons.Remapper remapper) {
|
||||||
this(Opcodes.ASM5, av, remapper);
|
this(Constants.ASM_VERSION, av, remapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RemappingAnnotationAdapter(final int api,
|
protected RemappingAnnotationAdapter(final int api,
|
||||||
|
|
|
@ -34,8 +34,8 @@ import org.objectweb.asm.AnnotationVisitor;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
import org.objectweb.asm.FieldVisitor;
|
import org.objectweb.asm.FieldVisitor;
|
||||||
import org.objectweb.asm.MethodVisitor;
|
import org.objectweb.asm.MethodVisitor;
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.objectweb.asm.TypePath;
|
import org.objectweb.asm.TypePath;
|
||||||
|
import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link ClassVisitor} for type remapping.
|
* A {@link ClassVisitor} for type remapping.
|
||||||
|
@ -49,7 +49,7 @@ public class RemappingClassAdapter extends ClassVisitor {
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) {
|
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,
|
protected RemappingClassAdapter(final int api, final ClassVisitor cv,
|
||||||
|
|
|
@ -32,9 +32,9 @@ package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
|
||||||
|
|
||||||
import org.objectweb.asm.AnnotationVisitor;
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
import org.objectweb.asm.FieldVisitor;
|
import org.objectweb.asm.FieldVisitor;
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.objectweb.asm.TypePath;
|
import org.objectweb.asm.TypePath;
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
|
import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link FieldVisitor} adapter for type remapping.
|
* A {@link FieldVisitor} adapter for type remapping.
|
||||||
|
@ -46,7 +46,7 @@ public class RemappingFieldAdapter extends FieldVisitor {
|
||||||
private final org.objectweb.asm.commons.Remapper remapper;
|
private final org.objectweb.asm.commons.Remapper remapper;
|
||||||
|
|
||||||
public RemappingFieldAdapter(final FieldVisitor fv, 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,
|
protected RemappingFieldAdapter(final int api, final FieldVisitor fv,
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.TypePath;
|
import org.objectweb.asm.TypePath;
|
||||||
import org.objectweb.asm.commons.LocalVariablesSorter;
|
import org.objectweb.asm.commons.LocalVariablesSorter;
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
|
import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link LocalVariablesSorter} for type mapping.
|
* A {@link LocalVariablesSorter} for type mapping.
|
||||||
|
@ -50,7 +51,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
|
||||||
|
|
||||||
public RemappingMethodAdapter(final int access, final String desc,
|
public RemappingMethodAdapter(final int access, final String desc,
|
||||||
final MethodVisitor mv, final org.objectweb.asm.commons.Remapper remapper) {
|
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,
|
protected RemappingMethodAdapter(final int api, final int access,
|
||||||
|
@ -125,7 +126,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
|
||||||
@Override
|
@Override
|
||||||
public void visitMethodInsn(final int opcode, final String owner,
|
public void visitMethodInsn(final int opcode, final String owner,
|
||||||
final String name, final String desc) {
|
final String name, final String desc) {
|
||||||
if (api >= Opcodes.ASM5) {
|
if (api >= Constants.ASM_VERSION) {
|
||||||
super.visitMethodInsn(opcode, owner, name, desc);
|
super.visitMethodInsn(opcode, owner, name, desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
|
||||||
@Override
|
@Override
|
||||||
public void visitMethodInsn(final int opcode, final String owner,
|
public void visitMethodInsn(final int opcode, final String owner,
|
||||||
final String name, final String desc, final boolean itf) {
|
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);
|
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
|
|
||||||
package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
|
package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
|
||||||
|
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
import org.objectweb.asm.signature.SignatureVisitor;
|
import org.objectweb.asm.signature.SignatureVisitor;
|
||||||
|
import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link SignatureVisitor} adapter for type mapping.
|
* A {@link SignatureVisitor} adapter for type mapping.
|
||||||
|
@ -49,7 +49,7 @@ public class RemappingSignatureAdapter extends SignatureVisitor {
|
||||||
|
|
||||||
public RemappingSignatureAdapter(final SignatureVisitor v,
|
public RemappingSignatureAdapter(final SignatureVisitor v,
|
||||||
final org.objectweb.asm.commons.Remapper remapper) {
|
final org.objectweb.asm.commons.Remapper remapper) {
|
||||||
this(Opcodes.ASM5, v, remapper);
|
this(Constants.ASM_VERSION, v, remapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RemappingSignatureAdapter(final int api,
|
protected RemappingSignatureAdapter(final int api,
|
||||||
|
|
Loading…
Reference in a new issue