public class ASMHelper
extends java.lang.Object
| Constructor and Description |
|---|
ASMHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addField(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
org.objectweb.asm.Type type,
java.lang.String signature,
java.lang.Object value) |
static void |
addNewInstance(org.objectweb.asm.MethodVisitor method,
java.lang.String name,
java.lang.String desc,
boolean isInterface) |
static void |
addSuperConstructor(org.objectweb.asm.MethodVisitor constructor,
java.lang.String name,
java.lang.String desc,
boolean isInterface) |
static void |
addSuperConstructor(org.objectweb.asm.MethodVisitor constructor,
java.lang.String name,
java.lang.String desc,
boolean isInterface,
int parameterCount) |
static java.lang.String |
buildSignature(org.objectweb.asm.Type base,
java.lang.String... innerSignatures) |
static java.lang.String |
buildSignature(org.objectweb.asm.Type base,
java.lang.String inner) |
static java.lang.String |
buildSignature(org.objectweb.asm.Type base,
org.objectweb.asm.Type... innerTypes) |
static void |
call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.String desc) |
static void |
call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.String desc,
boolean isInterface) |
static void |
call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String className,
java.lang.String methodName,
java.lang.String desc) |
static void |
call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String className,
java.lang.String methodName,
java.lang.String desc,
boolean isInterface) |
static void |
callEmpty(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String name,
java.lang.String methodName) |
static void |
callEmpty(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String name,
java.lang.String methodName,
boolean isInterface) |
static void |
callInit(org.objectweb.asm.MethodVisitor method,
java.lang.String name,
java.lang.String desc,
boolean isInterface) |
static byte[] |
editClass(byte[] byteCode,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer) |
static byte[] |
editClass(org.objectweb.asm.ClassReader reader,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer) |
static byte[] |
editClass(java.io.InputStream stream,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer) |
static byte[] |
editClass(java.lang.String className,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer) |
static org.objectweb.asm.tree.AbstractInsnNode |
findLabel(org.objectweb.asm.tree.InsnList code,
int ordinal) |
static @Nullable org.objectweb.asm.tree.AbstractInsnNode |
findNode(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,java.lang.Boolean> compare,
int ordinal) |
static org.objectweb.asm.tree.AbstractInsnNode |
findNodeOrFirst(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,java.lang.Boolean> compare,
int ordinal) |
static org.objectweb.asm.tree.AbstractInsnNode |
findNodeOrLast(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,java.lang.Boolean> compare,
int ordinal) |
static org.objectweb.asm.tree.AbstractInsnNode |
findReturn(org.objectweb.asm.tree.InsnList code) |
static org.objectweb.asm.tree.AbstractInsnNode |
findReturn(org.objectweb.asm.tree.InsnList code,
int ordinal) |
static void |
finishMethod(org.objectweb.asm.MethodVisitor visitor) |
static byte[] |
finishWriting(org.objectweb.asm.ClassWriter writer,
java.lang.String internalName,
boolean debugOutput)
Do not call ClassWriter#visitEnd before this
|
static byte[] |
finishWriting(org.objectweb.asm.ClassWriter writer,
org.objectweb.asm.Type type,
boolean debugOutput)
Do not call ClassWriter#visitEnd before this
|
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.ClassVisitor visitor,
java.lang.Class<?> clazz) |
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.ClassVisitor visitor,
java.lang.Class<?> clazz,
boolean runtime) |
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.ClassVisitor visitor,
org.objectweb.asm.Type type) |
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.ClassVisitor visitor,
org.objectweb.asm.Type type,
boolean runtime) |
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.MethodVisitor visitor,
java.lang.Class<?> clazz) |
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.MethodVisitor visitor,
java.lang.Class<?> clazz,
boolean runtime) |
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.MethodVisitor visitor,
org.objectweb.asm.Type type) |
static org.objectweb.asm.AnnotationVisitor |
getAnnotation(org.objectweb.asm.MethodVisitor visitor,
org.objectweb.asm.Type type,
boolean runtime) |
static byte[] |
getBytes(org.objectweb.asm.ClassReader reader) |
static byte[] |
getBytes(java.io.InputStream stream) |
static byte[] |
getBytes(java.net.URL url) |
static byte[] |
getBytes(java.net.URLConnection connection) |
static org.objectweb.asm.MethodVisitor |
getClassInit(org.objectweb.asm.ClassVisitor visitor) |
static org.objectweb.asm.MethodVisitor |
getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String[] exceptions,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String signature,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String signature,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String signature,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String[] exceptions,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String signature,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.MethodVisitor |
getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
org.objectweb.asm.Type... argTypes) |
static org.objectweb.asm.ClassReader |
getReader(java.lang.Class<?> clazz) |
static org.objectweb.asm.ClassReader |
getReader(org.objectweb.asm.Type type) |
static org.objectweb.asm.ClassWriter |
getWriter(org.objectweb.asm.ClassReader reader) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
java.lang.String internalName,
java.lang.String internalSuperName) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
java.lang.String internalName,
java.lang.String signature,
java.lang.String internalSuperName,
java.lang.String[] interfaces) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
java.lang.String internalName,
org.objectweb.asm.Type superType) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
org.objectweb.asm.Type type) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String[] interfaces) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String signature,
java.lang.String[] interfaces) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String signature,
org.objectweb.asm.Type superType) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String signature,
org.objectweb.asm.Type superType,
java.lang.String[] interfaces) |
static org.objectweb.asm.ClassWriter |
getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
org.objectweb.asm.Type superType) |
static boolean |
isValidReplacement(org.objectweb.asm.tree.AbstractInsnNode node,
@Nullable org.objectweb.asm.tree.AbstractInsnNode replacement) |
static boolean |
isValidReplacement(org.objectweb.asm.tree.AbstractInsnNode node,
@Nullable org.objectweb.asm.tree.InsnList replacement) |
static void |
replaceNode(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,org.objectweb.asm.tree.AbstractInsnNode> replacer,
int min,
int max)
Set replacements to null to remove nodes
|
static void |
replaceNodes(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,org.objectweb.asm.tree.InsnList> replacer,
int min,
int max)
Set replacements to null or an empty lists to remove nodes
|
static byte[] |
toBytes(@Nullable org.objectweb.asm.tree.ClassNode node) |
static byte[] |
toBytes(@Nullable org.objectweb.asm.tree.ClassNode node,
int flags)
Input flags should either be ASMRef.COMPUTE_FRAMES, ASMRef.COMPUTE_MAXS, or 0
|
static org.objectweb.asm.tree.ClassNode |
toClassNode(byte[] byteCode) |
static org.objectweb.asm.tree.ClassNode |
toClassNode(byte[] byteCode,
int parsingOptions) |
static void |
writeByteCodeToFile(java.io.File file,
byte[] bytes) |
static void |
writeDebugByteCode(java.lang.String classpath,
byte[] bytes) |
public static void addField(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
org.objectweb.asm.Type type,
java.lang.String signature,
java.lang.Object value)
public static void addSuperConstructor(org.objectweb.asm.MethodVisitor constructor,
java.lang.String name,
java.lang.String desc,
boolean isInterface)
public static void addSuperConstructor(org.objectweb.asm.MethodVisitor constructor,
java.lang.String name,
java.lang.String desc,
boolean isInterface,
int parameterCount)
public static void addNewInstance(org.objectweb.asm.MethodVisitor method,
java.lang.String name,
java.lang.String desc,
boolean isInterface)
public static java.lang.String buildSignature(org.objectweb.asm.Type base,
org.objectweb.asm.Type... innerTypes)
public static java.lang.String buildSignature(org.objectweb.asm.Type base,
java.lang.String... innerSignatures)
public static java.lang.String buildSignature(org.objectweb.asm.Type base,
java.lang.String inner)
public static void call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.String desc)
public static void call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String className,
java.lang.String methodName,
java.lang.String desc)
public static void call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.String desc,
boolean isInterface)
public static void call(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String className,
java.lang.String methodName,
java.lang.String desc,
boolean isInterface)
public static void callEmpty(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String name,
java.lang.String methodName)
public static void callEmpty(org.objectweb.asm.MethodVisitor method,
int opcode,
java.lang.String name,
java.lang.String methodName,
boolean isInterface)
public static void callInit(org.objectweb.asm.MethodVisitor method,
java.lang.String name,
java.lang.String desc,
boolean isInterface)
public static byte[] editClass(java.lang.String className,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] editClass(java.io.InputStream stream,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] editClass(byte[] byteCode,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer)
public static byte[] editClass(org.objectweb.asm.ClassReader reader,
java.util.function.Consumer<org.objectweb.asm.ClassWriter> consumer)
public static org.objectweb.asm.tree.AbstractInsnNode findLabel(org.objectweb.asm.tree.InsnList code,
int ordinal)
@Nullable
public static @Nullable org.objectweb.asm.tree.AbstractInsnNode findNode(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,java.lang.Boolean> compare,
int ordinal)
public static org.objectweb.asm.tree.AbstractInsnNode findNodeOrFirst(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,java.lang.Boolean> compare,
int ordinal)
public static org.objectweb.asm.tree.AbstractInsnNode findNodeOrLast(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,java.lang.Boolean> compare,
int ordinal)
public static org.objectweb.asm.tree.AbstractInsnNode findReturn(org.objectweb.asm.tree.InsnList code)
public static org.objectweb.asm.tree.AbstractInsnNode findReturn(org.objectweb.asm.tree.InsnList code,
int ordinal)
public static void finishMethod(org.objectweb.asm.MethodVisitor visitor)
public static byte[] finishWriting(org.objectweb.asm.ClassWriter writer,
org.objectweb.asm.Type type,
boolean debugOutput)
public static byte[] finishWriting(org.objectweb.asm.ClassWriter writer,
java.lang.String internalName,
boolean debugOutput)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.ClassVisitor visitor,
java.lang.Class<?> clazz)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.MethodVisitor visitor,
java.lang.Class<?> clazz)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.ClassVisitor visitor,
org.objectweb.asm.Type type)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.MethodVisitor visitor,
org.objectweb.asm.Type type)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.ClassVisitor visitor,
java.lang.Class<?> clazz,
boolean runtime)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.MethodVisitor visitor,
java.lang.Class<?> clazz,
boolean runtime)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.ClassVisitor visitor,
org.objectweb.asm.Type type,
boolean runtime)
public static org.objectweb.asm.AnnotationVisitor getAnnotation(org.objectweb.asm.MethodVisitor visitor,
org.objectweb.asm.Type type,
boolean runtime)
public static byte[] getBytes(java.net.URL url)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getBytes(java.net.URLConnection connection)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getBytes(java.io.InputStream stream)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getBytes(org.objectweb.asm.ClassReader reader)
public static org.objectweb.asm.MethodVisitor getClassInit(org.objectweb.asm.ClassVisitor visitor)
public static org.objectweb.asm.MethodVisitor getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String signature,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String[] exceptions,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String signature,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getConstructor(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String signature,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String[] exceptions,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String signature,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.MethodVisitor getMethod(org.objectweb.asm.ClassVisitor visitor,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String[] exceptions,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... argTypes)
public static org.objectweb.asm.ClassReader getReader(java.lang.Class<?> clazz)
throws java.io.IOException
java.io.IOExceptionpublic static org.objectweb.asm.ClassReader getReader(org.objectweb.asm.Type type)
throws java.io.IOException
java.io.IOExceptionpublic static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
org.objectweb.asm.Type type)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String[] interfaces)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String signature,
java.lang.String[] interfaces)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
java.lang.String internalName,
java.lang.String internalSuperName)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
java.lang.String internalName,
org.objectweb.asm.Type superType)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
org.objectweb.asm.Type superType)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String signature,
org.objectweb.asm.Type superType)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
org.objectweb.asm.Type type,
java.lang.String signature,
org.objectweb.asm.Type superType,
java.lang.String[] interfaces)
public static org.objectweb.asm.ClassWriter getWriter(int javaVer,
int access,
java.lang.String internalName,
java.lang.String signature,
java.lang.String internalSuperName,
java.lang.String[] interfaces)
public static org.objectweb.asm.ClassWriter getWriter(org.objectweb.asm.ClassReader reader)
public static boolean isValidReplacement(org.objectweb.asm.tree.AbstractInsnNode node,
@Nullable
@Nullable org.objectweb.asm.tree.AbstractInsnNode replacement)
public static boolean isValidReplacement(org.objectweb.asm.tree.AbstractInsnNode node,
@Nullable
@Nullable org.objectweb.asm.tree.InsnList replacement)
public static void replaceNode(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,org.objectweb.asm.tree.AbstractInsnNode> replacer,
int min,
int max)
public static void replaceNodes(org.objectweb.asm.tree.InsnList code,
java.util.function.Function<org.objectweb.asm.tree.AbstractInsnNode,org.objectweb.asm.tree.InsnList> replacer,
int min,
int max)
public static byte[] toBytes(@Nullable
@Nullable org.objectweb.asm.tree.ClassNode node)
public static byte[] toBytes(@Nullable
@Nullable org.objectweb.asm.tree.ClassNode node,
int flags)
public static org.objectweb.asm.tree.ClassNode toClassNode(byte[] byteCode)
public static org.objectweb.asm.tree.ClassNode toClassNode(byte[] byteCode,
int parsingOptions)
public static void writeByteCodeToFile(java.io.File file,
byte[] bytes)
public static void writeDebugByteCode(java.lang.String classpath,
byte[] bytes)