net.bytebuddy.instrumentation.method.bytecode.stack.constant.NullConstant Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of byte-buddy Show documentation
Show all versions of byte-buddy Show documentation
Byte Buddy is a Java library for creating Java classes at run time.
This artifact is a build of Byte Buddy with all ASM dependencies repackaged into its own name space.
package net.bytebuddy.instrumentation.method.bytecode.stack.constant;
import net.bytebuddy.instrumentation.Instrumentation;
import net.bytebuddy.instrumentation.method.bytecode.stack.StackManipulation;
import net.bytebuddy.instrumentation.method.bytecode.stack.StackSize;
import net.bytebuddy.jar.asm.MethodVisitor;
import net.bytebuddy.jar.asm.Opcodes;
/**
* Represents a stack manipulation to load a {@code null} pointer onto the operand stack.
*/
public enum NullConstant implements StackManipulation {
/**
* The singleton instance.
*/
INSTANCE;
/**
* The size impact of loading the {@code null} reference onto the operand stack.
*/
private static final Size SIZE = StackSize.SINGLE.toIncreasingSize();
@Override
public boolean isValid() {
return true;
}
@Override
public Size apply(MethodVisitor methodVisitor, Instrumentation.Context instrumentationContext) {
methodVisitor.visitInsn(Opcodes.ACONST_NULL);
return SIZE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy