org.testifyproject.bytebuddy.implementation.bytecode.Throw Maven / Gradle / Ivy
package org.testifyproject.bytebuddy.implementation.bytecode;
import org.testifyproject.bytebuddy.implementation.Implementation;
import org.testifyproject.bytebuddy.jar.asm.MethodVisitor;
import org.testifyproject.bytebuddy.jar.asm.Opcodes;
/**
* Throws a {@link java.lang.Throwable} which must lie on top of the stack when this stack manipulation is called.
*/
public enum Throw implements StackManipulation {
/**
* The singleton instance.
*/
INSTANCE;
@Override
public boolean isValid() {
return true;
}
@Override
public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) {
methodVisitor.visitInsn(Opcodes.ATHROW);
return StackSize.SINGLE.toDecreasingSize();
}
@Override
public String toString() {
return "Throw." + name();
}
}