com.ui4j.bytebuddy.instrumentation.method.bytecode.stack.constant.NullConstant Maven / Gradle / Ivy
package com.ui4j.bytebuddy.instrumentation.method.bytecode.stack.constant;
import com.ui4j.bytebuddy.instrumentation.Instrumentation;
import com.ui4j.bytebuddy.instrumentation.method.bytecode.stack.StackManipulation;
import com.ui4j.bytebuddy.instrumentation.method.bytecode.stack.StackSize;
import com.ui4j.bytebuddy.jar.asm.MethodVisitor;
import com.ui4j.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 - 2024 Weber Informatics LLC | Privacy Policy