public class AsmUtil extends Object
| Constructor and Description |
|---|
AsmUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
boxIfRequired(org.objectweb.asm.MethodVisitor mv,
org.jboss.jandex.Type jandexType)
Calls the right boxing method for the given Jandex Type if it is a primitive.
|
static String |
getDescriptor(org.jboss.jandex.MethodInfo method,
Function<String,String> typeArgMapper)
Returns the Java bytecode descriptor of a given Jandex MethodInfo using the given type argument mappings.
|
static String |
getDescriptor(org.jboss.jandex.Type type,
Function<String,String> typeArgMapper)
Returns the Java bytecode descriptor of a given Jandex Type using the given type argument mappings.
|
static int |
getLoadOpcode(org.jboss.jandex.Type jandexType)
Returns the bytecode instruction to load the given Jandex Type.
|
static int |
getParameterSize(org.jboss.jandex.Type paramType)
Returns the number of underlying bytecode parameters taken by the given Jandex parameter Type.
|
static org.jboss.jandex.Type[] |
getParameterTypes(String methodDescriptor)
Returns the Jandex Types of the parameters of the given method descriptor.
|
static int |
getReturnInstruction(String typeDescriptor)
Returns a return bytecode instruction suitable for the given return type descriptor.
|
static int |
getReturnInstruction(org.jboss.jandex.Type jandexType)
Returns a return bytecode instruction suitable for the given return Jandex Type.
|
static String |
getSignature(org.jboss.jandex.MethodInfo method,
Function<String,String> typeArgMapper)
Returns the Java bytecode signature of a given Jandex MethodInfo using the given type argument mappings.
|
static void |
printValueOnStderr(org.objectweb.asm.MethodVisitor mv,
Runnable valuePusher)
Prints the value pushed on the stack (must be an Object) by the given valuePusher
to STDERR.
|
static void |
unboxIfRequired(org.objectweb.asm.MethodVisitor mv,
org.jboss.jandex.Type jandexType)
Calls the right unboxing method for the given Jandex Type if it is a primitive.
|
static void |
visitLdc(org.objectweb.asm.MethodVisitor mv,
org.jboss.jandex.Type jandexType)
Invokes the proper LDC Class Constant instructions for the given Jandex Type.
|
public static String getSignature(org.jboss.jandex.MethodInfo method, Function<String,String> typeArgMapper)
public class Foo<T> {
public <R> List<R> method(int a, T t){...}
}
This will return <R:Ljava/lang/Object;>(ILjava/lang/Integer;)Ljava/util/List<TR;>; if
your typeArgMapper contains T=Ljava/lang/Integer;.method - the method you want the signature for.typeArgMapper - a mapping between type argument names and their bytecode signature.public static String getDescriptor(org.jboss.jandex.MethodInfo method, Function<String,String> typeArgMapper)
public class Foo<T> {
public <R> List<R> method(int a, T t){...}
}
This will return (ILjava/lang/Integer;)Ljava/util/List; if
your typeArgMapper contains T=Ljava/lang/Integer;.method - the method you want the descriptor for.typeArgMapper - a mapping between type argument names and their bytecode descriptor.public static String getDescriptor(org.jboss.jandex.Type type, Function<String,String> typeArgMapper)
typeArgMapper contains T=Ljava/lang/Integer;.type - the type you want the descriptor for.typeArgMapper - a mapping between type argument names and their bytecode descriptor.public static int getReturnInstruction(String typeDescriptor)
typeDescriptor - the return type descriptor.public static int getReturnInstruction(org.jboss.jandex.Type jandexType)
typeDescriptor - the return Jandex Type.public static void visitLdc(org.objectweb.asm.MethodVisitor mv,
org.jboss.jandex.Type jandexType)
mv - The MethodVisitor on which to visit the LDC instructionsjandexType - the Jandex Type whose Class Constant to load.public static void boxIfRequired(org.objectweb.asm.MethodVisitor mv,
org.jboss.jandex.Type jandexType)
mv - The MethodVisitor on which to visit the boxing instructionsjandexType - The Jandex Type to box if it is a primitive.public static int getLoadOpcode(org.jboss.jandex.Type jandexType)
jandexType - The Jandex Type whose load instruction to return.public static void unboxIfRequired(org.objectweb.asm.MethodVisitor mv,
org.jboss.jandex.Type jandexType)
mv - The MethodVisitor on which to visit the unboxing instructionsjandexType - The Jandex Type to unbox if it is a primitive.public static org.jboss.jandex.Type[] getParameterTypes(String methodDescriptor)
methodDescriptor - a method descriptorpublic static int getParameterSize(org.jboss.jandex.Type paramType)
paramType - the Jandex parameter Typepublic static void printValueOnStderr(org.objectweb.asm.MethodVisitor mv,
Runnable valuePusher)
mv - The MethodVisitor to forward printing to.valuePusher - The function to invoke to push an Object to print on the stack.Copyright © 2020 JBoss by Red Hat. All rights reserved.