/** * Creates a new method return manipulation. * * @param returnOpcode The opcode of this operation. * @param stackSize The operand stack size change that is implied by this operation. */ MethodReturn(int returnOpcode, StackSize stackSize) { this.returnOpcode = returnOpcode; size = stackSize.toDecreasingSize(); }
/** * Creates a new removal stack manipulation. * * @param stackSize The size impact of the removal onto the operand stack. * @param opcode The opcode to execute for the removal. */ Removal(StackSize stackSize, int opcode) { size = stackSize.toDecreasingSize(); this.opcode = opcode; }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitVarInsn(storeOpcode, offset); return size.toDecreasingSize(); } }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitInsn(opcode); return stackSize.toDecreasingSize(); } }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitInsn(opcode); return stackSize.toDecreasingSize(); } }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitInsn(Opcodes.ATHROW); return StackSize.SINGLE.toDecreasingSize(); } }
/** * Creates a new array factory with a given * {@link net.bytebuddy.implementation.bytecode.collection.ArrayFactory.ArrayCreator} * without inferring the type from the component type. Normally, * {@link net.bytebuddy.implementation.bytecode.collection.ArrayFactory#forType(net.bytebuddy.description.type.TypeDescription.Generic)} * should be used. * * @param componentType The component type of the array factory. * @param arrayCreator The array creator responsible for providing the correct byte code instructions. */ protected ArrayFactory(TypeDescription.Generic componentType, ArrayCreator arrayCreator) { this.componentType = componentType; this.arrayCreator = arrayCreator; // Size decreases by index and array reference (2) and array element (1, 2) after each element storage. sizeDecrease = StackSize.DOUBLE.toDecreasingSize().aggregate(componentType.getStackSize().toDecreasingSize()); }
/** * Creates a new primitive boxing delegate. * * @param wrapperType A description of a wrapper type. * @param sizeDifference The size difference between a primitive type and its wrapper type. * @param boxingMethodName The name of the method for boxing a primitive value as its wrapper type. * @param boxingMethodDescriptor The descriptor of the method for boxing a primitive value as its wrapper type. */ PrimitiveBoxingDelegate(Class<?> wrapperType, StackSize sizeDifference, String boxingMethodName, String boxingMethodDescriptor) { this.wrapperType = TypeDescription.ForLoadedType.of(wrapperType); this.size = sizeDifference.toDecreasingSize(); this.boxingMethodName = boxingMethodName; this.boxingMethodDescriptor = boxingMethodDescriptor; }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitInsn(storeOpcode); return stackSize.toDecreasingSize().aggregate(new Size(-2, 0)); } }
PrimitiveBoxing(Class<?> wrapperType, StackSize sizeDifference, String boxingMethodName, String boxingMethodDescriptor) { this.wrapperType = new TypeDescription.ForLoadedType(wrapperType); this.size = sizeDifference.toDecreasingSize(); this.boxingMethodName = boxingMethodName; this.boxingMethodDescriptor = boxingMethodDescriptor; }