Class AsmHelper
java.lang.Object
eu.cloudnetservice.driver.util.asm.AsmHelper
The AsmHelper provides util methods for commonly used asm operations.
- Since:
- 4.0
- See Also:
-
Opcodes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidprimitiveToWrapper(@NonNull org.objectweb.asm.MethodVisitor mv, @NonNull Class<?> primitiveType) Wraps a primitive type into it's wrapper type and pushes it onto the givenMethodVisitor.static voidPushes the given int value onto the stack.static voidwrapperToPrimitive(@NonNull org.objectweb.asm.MethodVisitor mv, @NonNull Class<?> primitiveType) Unwraps a primitive wrapper to the raw primitive type and pushes it onto the givenMethodVisitor.
-
Constructor Details
-
AsmHelper
private AsmHelper()
-
-
Method Details
-
pushInt
Pushes the given int value onto the stack. The following table shows the opcodes which are used based on the given int value.- values < -1 or >
Short.MAX_VALUE: LDC - values >= -1 and <= 5: ICONST_M1 - ICONST_5
- values <=
Byte.MAX_VALUE: BIPUSH - values <=
Short.MAX_VALUE: SIPUSH
- Parameters:
mv- the visitor to push to.value- the value to push onto the stack.
- values < -1 or >
-
wrapperToPrimitive
public static void wrapperToPrimitive(@NonNull @NonNull org.objectweb.asm.MethodVisitor mv, @NonNull @NonNull Class<?> primitiveType) Unwraps a primitive wrapper to the raw primitive type and pushes it onto the givenMethodVisitor. Counterpart to this isprimitiveToWrapper(MethodVisitor, Class).- Parameters:
mv- the visitor to push to.primitiveType- the class of the primitive type
-
primitiveToWrapper
public static void primitiveToWrapper(@NonNull @NonNull org.objectweb.asm.MethodVisitor mv, @NonNull @NonNull Class<?> primitiveType) Wraps a primitive type into it's wrapper type and pushes it onto the givenMethodVisitor. Counterpart to this iswrapperToPrimitive(MethodVisitor, Class).- Parameters:
mv- the visitor to push to.primitiveType- the class of the primitive type
-