@Test public void testAdviceAbstractMethodIsSkipped() throws Exception { Advice.Dispatcher.Resolved.ForMethodEnter methodEnter = mock(Advice.Dispatcher.Resolved.ForMethodEnter.class); Advice.Dispatcher.Resolved.ForMethodExit methodExit = mock(Advice.Dispatcher.Resolved.ForMethodExit.class); MethodDescription.InDefinedShape methodDescription = mock(MethodDescription.InDefinedShape.class); when(methodDescription.isAbstract()).thenReturn(true); MethodVisitor methodVisitor = mock(MethodVisitor.class); assertThat(new Advice(methodEnter, methodExit).wrap(mock(TypeDescription.class), methodDescription, methodVisitor, mock(Implementation.Context.class), mock(TypePool.class), IGNORED, IGNORED), sameInstance(methodVisitor)); }
public MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodVisitor methodVisitor, Implementation.Context implementationContext, TypePool typePool, int writerFlags, int readerFlags) { return instrumentedMethod.isAbstract() || instrumentedMethod.isNative() ? methodVisitor : doWrap(instrumentedType, instrumentedMethod, methodVisitor, implementationContext, writerFlags, readerFlags); }
Advice implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper, Implementation { public MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodVisitor methodVisitor, Implementation.Context implementationContext, TypePool typePool, int writerFlags, int readerFlags) { return instrumentedMethod.isAbstract() || instrumentedMethod.isNative() ? methodVisitor : doWrap(instrumentedType, instrumentedMethod, methodVisitor, implementationContext, writerFlags, readerFlags); } }
Advice implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper, Implementation { public MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodVisitor methodVisitor, Implementation.Context implementationContext, TypePool typePool, int writerFlags, int readerFlags) { return instrumentedMethod.isAbstract() || instrumentedMethod.isNative() ? methodVisitor : doWrap(instrumentedType, instrumentedMethod, methodVisitor, implementationContext, writerFlags, readerFlags); } protected  Advice(Dispatcher.Resolved.ForMethodEnter methodEnter, Dispatcher.Resolved.ForMethodExit methodExit); private  Advice(Dispatcher.Resolved.ForMethodEnter methodEnter,
                   Dispatcher.Resolved.ForMethodExit methodExit,
                   Assigner assigner,
                   ExceptionHandler exceptionHandler,
                   Implementation delegate); }
Advice implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper, Implementation { public MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodVisitor methodVisitor, Implementation.Context implementationContext, TypePool typePool, int writerFlags, int readerFlags) { return instrumentedMethod.isAbstract() || instrumentedMethod.isNative() ? methodVisitor : doWrap(instrumentedType, instrumentedMethod, methodVisitor, implementationContext, writerFlags, readerFlags); } protected  Advice(Dispatcher.Resolved.ForMethodEnter methodEnter, Dispatcher.Resolved.ForMethodExit methodExit); private  Advice(Dispatcher.Resolved.ForMethodEnter methodEnter,
                   Dispatcher.Resolved.ForMethodExit methodExit,
                   Assigner assigner,
                   ExceptionHandler exceptionHandler,
                   Implementation delegate); static Advice to(Class<?> advice); static Advice to(Class<?> advice, ClassFileLocator classFileLocator); static Advice to(TypeDescription advice); static Advice to(TypeDescription advice, ClassFileLocator classFileLocator); static Advice to(Class<?> enterAdvice, Class<?> exitAdvice); static Advice to(Class<?> enterAdvice, Class<?> exitAdvice, ClassFileLocator classFileLocator); static Advice to(TypeDescription enterAdvice, TypeDescription exitAdvice); static Advice to(TypeDescription enterAdvice, TypeDescription exitAdvice, ClassFileLocator classFileLocator); static WithCustomMapping withCustomMapping(); AsmVisitorWrapper.ForDeclaredMethods on(ElementMatcher<? super MethodDescription> matcher); MethodVisitor wrap(TypeDescription instrumentedType,
                              MethodDescription instrumentedMethod,
                              MethodVisitor methodVisitor,
                              Implementation.Context implementationContext,
                              TypePool typePool,
                              int writerFlags,
                              int readerFlags); InstrumentedType prepare(InstrumentedType instrumentedType); ByteCodeAppender appender(Target implementationTarget); Advice withAssigner(Assigner assigner); Advice withExceptionPrinting(); Advice withExceptionHandler(StackManipulation exceptionHandler); Advice withExceptionHandler(ExceptionHandler exceptionHandler); Implementation wrap(Implementation implementation); }
Advice implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper, Implementation { public MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodVisitor methodVisitor, Implementation.Context implementationContext, TypePool typePool, int writerFlags, int readerFlags) { return instrumentedMethod.isAbstract() || instrumentedMethod.isNative() ? methodVisitor : doWrap(instrumentedType, instrumentedMethod, methodVisitor, implementationContext, writerFlags, readerFlags); } protected  Advice(Dispatcher.Resolved.ForMethodEnter methodEnter, Dispatcher.Resolved.ForMethodExit methodExit); private  Advice(Dispatcher.Resolved.ForMethodEnter methodEnter,
                   Dispatcher.Resolved.ForMethodExit methodExit,
                   Assigner assigner,
                   ExceptionHandler exceptionHandler,
                   Implementation delegate); static Advice to(Class<?> advice); static Advice to(Class<?> advice, ClassFileLocator classFileLocator); static Advice to(TypeDescription advice); static Advice to(TypeDescription advice, ClassFileLocator classFileLocator); static Advice to(Class<?> enterAdvice, Class<?> exitAdvice); static Advice to(Class<?> enterAdvice, Class<?> exitAdvice, ClassFileLocator classFileLocator); static Advice to(TypeDescription enterAdvice, TypeDescription exitAdvice); static Advice to(TypeDescription enterAdvice, TypeDescription exitAdvice, ClassFileLocator classFileLocator); static WithCustomMapping withCustomMapping(); AsmVisitorWrapper.ForDeclaredMethods on(ElementMatcher<? super MethodDescription> matcher); MethodVisitor wrap(TypeDescription instrumentedType,
                              MethodDescription instrumentedMethod,
                              MethodVisitor methodVisitor,
                              Implementation.Context implementationContext,
                              TypePool typePool,
                              int writerFlags,
                              int readerFlags); InstrumentedType prepare(InstrumentedType instrumentedType); ByteCodeAppender appender(Target implementationTarget); Advice withAssigner(Assigner assigner); Advice withExceptionPrinting(); Advice withExceptionHandler(StackManipulation exceptionHandler); Advice withExceptionHandler(ExceptionHandler exceptionHandler); Implementation wrap(Implementation implementation);  }