use of org.apache.beam.vendor.bytebuddy.v1_11_0.net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class MethodVariableAccessOfMethodArgumentsTest method testNonStaticMethodWithPrepending.
@Test
public void testNonStaticMethodWithPrepending() throws Exception {
StackManipulation stackManipulation = MethodVariableAccess.allArgumentsOf(methodDescription).prependThisReference();
assertThat(stackManipulation.isValid(), is(true));
StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext);
assertThat(size.getSizeImpact(), is(PARAMETER_STACK_SIZE + 1));
assertThat(size.getMaximalSize(), is(PARAMETER_STACK_SIZE + 1));
verify(methodVisitor).visitVarInsn(Opcodes.ALOAD, 0);
verify(methodVisitor).visitVarInsn(Opcodes.ALOAD, 1);
verify(methodVisitor).visitVarInsn(Opcodes.ALOAD, 2);
verifyNoMoreInteractions(methodVisitor);
}
use of org.apache.beam.vendor.bytebuddy.v1_11_0.net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class MethodVariableAccessOfMethodArgumentsTest method testStaticMethodWithPrepending.
@Test
public void testStaticMethodWithPrepending() throws Exception {
when(methodDescription.isStatic()).thenReturn(true);
StackManipulation stackManipulation = MethodVariableAccess.allArgumentsOf(methodDescription).prependThisReference();
assertThat(stackManipulation.isValid(), is(true));
StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext);
assertThat(size.getSizeImpact(), is(PARAMETER_STACK_SIZE));
assertThat(size.getMaximalSize(), is(PARAMETER_STACK_SIZE));
verify(methodVisitor).visitVarInsn(Opcodes.ALOAD, 0);
verify(methodVisitor).visitVarInsn(Opcodes.ALOAD, 1);
verifyNoMoreInteractions(methodVisitor);
}
use of org.apache.beam.vendor.bytebuddy.v1_11_0.net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class AssignerEqualTypesOnlyTest method testAssignmentErausreEqual.
@Test
public void testAssignmentErausreEqual() throws Exception {
StackManipulation stackManipulation = Assigner.EqualTypesOnly.ERASURE.assign(first, first, Assigner.Typing.of(dynamicallyTyped));
assertThat(stackManipulation.isValid(), is(true));
StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext);
assertThat(size.getSizeImpact(), is(0));
assertThat(size.getMaximalSize(), is(0));
verify(first, times(2)).asErasure();
verifyNoMoreInteractions(first);
}
use of org.apache.beam.vendor.bytebuddy.v1_11_0.net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class AssignerEqualTypesOnlyTest method testAssignmentGenericEqual.
@Test
public void testAssignmentGenericEqual() throws Exception {
StackManipulation stackManipulation = Assigner.EqualTypesOnly.GENERIC.assign(first, first, Assigner.Typing.of(dynamicallyTyped));
assertThat(stackManipulation.isValid(), is(true));
StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext);
assertThat(size.getSizeImpact(), is(0));
assertThat(size.getMaximalSize(), is(0));
verifyZeroInteractions(first);
}
use of org.apache.beam.vendor.bytebuddy.v1_11_0.net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class AssignerEqualTypesOnlyTest method testAssignmentGenericNotEqual.
@Test
public void testAssignmentGenericNotEqual() throws Exception {
StackManipulation stackManipulation = Assigner.EqualTypesOnly.GENERIC.assign(first, second, Assigner.Typing.of(dynamicallyTyped));
assertThat(stackManipulation.isValid(), is(false));
verifyZeroInteractions(first);
verifyZeroInteractions(second);
}
Aggregations