Class AsmHelper

java.lang.Object
eu.cloudnetservice.driver.util.asm.AsmHelper

@Internal public final class AsmHelper extends Object
The AsmHelper provides util methods for commonly used asm operations.
Since:
4.0
See Also:
  • Opcodes
  • Constructor Details

    • AsmHelper

      private AsmHelper()
  • Method Details

    • pushInt

      public static void pushInt(@NonNull @NonNull org.objectweb.asm.MethodVisitor mv, int value)
      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.
    • 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 given MethodVisitor. Counterpart to this is primitiveToWrapper(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 given MethodVisitor. Counterpart to this is wrapperToPrimitive(MethodVisitor, Class).
      Parameters:
      mv - the visitor to push to.
      primitiveType - the class of the primitive type