@Test public void testAssignVoidToVoid() throws Exception { when(sourceTypeDescription.represents(void.class)).thenReturn(true); when(targetTypeDescription.represents(void.class)).thenReturn(true); Assigner voidAwareAssigner = new VoidAwareAssigner(chainedAssigner); StackManipulation stackManipulation = voidAwareAssigner.assign(sourceTypeDescription, targetTypeDescription, Assigner.Typing.STATIC); assertThat(stackManipulation.isValid(), is(true)); StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext); assertThat(size.getSizeImpact(), is(0)); assertThat(size.getMaximalSize(), is(0)); verifyZeroInteractions(chainedAssigner); }
public StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Typing typing) { if (source.represents(void.class) && target.represents(void.class)) { return StackManipulation.Trivial.INSTANCE; } else if (source.represents(void.class) ) { return typing.isDynamic() ? DefaultValue.of(target) : StackManipulation.Illegal.INSTANCE; } else if ( target.represents(void.class)) { return Removal.of(source); } else { return chained.assign(source, target, typing); } }
VoidAwareAssigner implements Assigner { public StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Typing typing) { if (source.represents(void.class) && target.represents(void.class)) { return StackManipulation.Trivial.INSTANCE; } else if (source.represents(void.class) ) { return typing.isDynamic() ? DefaultValue.of(target) : StackManipulation.Illegal.INSTANCE; } else if ( target.represents(void.class)) { return Removal.of(source); } else { return chained.assign(source, target, typing); } } }
VoidAwareAssigner implements Assigner { public StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Typing typing) { if (source.represents(void.class) && target.represents(void.class)) { return StackManipulation.Trivial.INSTANCE; } else if (source.represents(void.class) ) { return typing.isDynamic() ? DefaultValue.of(target) : StackManipulation.Illegal.INSTANCE; } else if ( target.represents(void.class)) { return Removal.of(source); } else { return chained.assign(source, target, typing); } } VoidAwareAssigner(Assigner chained); }
VoidAwareAssigner implements Assigner { public StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Typing typing) { if (source.represents(void.class) && target.represents(void.class)) { return StackManipulation.Trivial.INSTANCE; } else if (source.represents(void.class) ) { return typing.isDynamic() ? DefaultValue.of(target) : StackManipulation.Illegal.INSTANCE; } else if ( target.represents(void.class)) { return Removal.of(source); } else { return chained.assign(source, target, typing); } } VoidAwareAssigner(Assigner chained); StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Typing typing); }
VoidAwareAssigner implements Assigner { public StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Typing typing) { if (source.represents(void.class) && target.represents(void.class)) { return StackManipulation.Trivial.INSTANCE; } else if (source.represents(void.class) ) { return typing.isDynamic() ? DefaultValue.of(target) : StackManipulation.Illegal.INSTANCE; } else if ( target.represents(void.class)) { return Removal.of(source); } else { return chained.assign(source, target, typing); } } VoidAwareAssigner(Assigner chained); StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Typing typing);  }