@Test public void testSuperConstructorIsInvokable() throws Exception { when(invokableMethod.isConstructor()).thenReturn(true); when(definedSuperClassConstructor.isSpecializableFor(rawSuperClass)).thenReturn(true); Implementation.SpecialMethodInvocation specialMethodInvocation = makeImplementationTarget().invokeSuper(superConstructorToken); assertThat(specialMethodInvocation.isValid(), is(true)); assertThat(specialMethodInvocation.getMethodDescription(), is((MethodDescription) superClassConstructor)); assertThat(specialMethodInvocation.getTypeDescription(), is(rawSuperClass)); MethodVisitor methodVisitor = mock(MethodVisitor.class); Implementation.Context implementationContext = mock(Implementation.Context.class); StackManipulation.Size size = specialMethodInvocation.apply(methodVisitor, implementationContext); verify(methodVisitor).visitMethodInsn(Opcodes.INVOKESPECIAL, BAR, QUX, BAZ, false); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); assertThat(size.getSizeImpact(), is(0)); assertThat(size.getMaximalSize(), is(0)); }
public Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token) { return token.getName().equals(MethodDescription.CONSTRUCTOR_INTERNAL_NAME) ? invokeConstructor(token) : invokeMethod(token); }
SubclassImplementationTarget extends Implementation.Target.AbstractBase { public Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token) { return token.getName().equals(MethodDescription.CONSTRUCTOR_INTERNAL_NAME) ? invokeConstructor(token) : invokeMethod(token); } }
SubclassImplementationTarget extends Implementation.Target.AbstractBase { public Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token) { return token.getName().equals(MethodDescription.CONSTRUCTOR_INTERNAL_NAME) ? invokeConstructor(token) : invokeMethod(token); } protected  SubclassImplementationTarget(TypeDescription instrumentedType,
                                           MethodGraph.Linked methodGraph,
                                           DefaultMethodInvocation defaultMethodInvocation,
                                           OriginTypeResolver originTypeResolver); }
SubclassImplementationTarget extends Implementation.Target.AbstractBase { public Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token) { return token.getName().equals(MethodDescription.CONSTRUCTOR_INTERNAL_NAME) ? invokeConstructor(token) : invokeMethod(token); } protected  SubclassImplementationTarget(TypeDescription instrumentedType,
                                           MethodGraph.Linked methodGraph,
                                           DefaultMethodInvocation defaultMethodInvocation,
                                           OriginTypeResolver originTypeResolver); Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token); TypeDefinition getOriginType(); }
SubclassImplementationTarget extends Implementation.Target.AbstractBase { public Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token) { return token.getName().equals(MethodDescription.CONSTRUCTOR_INTERNAL_NAME) ? invokeConstructor(token) : invokeMethod(token); } protected  SubclassImplementationTarget(TypeDescription instrumentedType,
                                           MethodGraph.Linked methodGraph,
                                           DefaultMethodInvocation defaultMethodInvocation,
                                           OriginTypeResolver originTypeResolver); Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token); TypeDefinition getOriginType();  }