SpringSource/spring-framework — pull request #342 by byungseok (2013-08-22 07:42:52+00:00)
Title: AfterReturning Advice is executed even if the return type doesn't match

When using @AfterReturning Advice, if a returning clause was specified,
then the advice is only invoked if the returned value is an instance
of the given returning type.

With following configuration, if a method's return type is int.class,
the advice is not invoked.

@AfterReturning(pointcut = "execution(* *(..))", returning = "string")
public void logResult(String string) { }

Following AspectJ semantics, if a return value is null(or return type
is void), then the returnType of target method should be used to
determine whether advice is invoked or not. Also even if return type
is void, if the type of argument declared in advice method is Object,
then the advice must be invoked.

That is, With above configuration, after execution of following method
the advice should not be invoked. But it is invoked in spring AOP.

public void doSomething() { }

Some contional statement has added into existing code, according to
following specification.

http://eclipse.org/aspectj/doc/released/progguide/semantics-advice.html

Thank you.

Issue: SPR-10834