This topic has not yet been written. The content below is from the topic description.
After Advices Differently from around advices, after advices are not forced to return a value. They should return it only when they intend to replace the joinpoint value. Let's take a look at a few examples; public int afterOverwriteReturnValue(@Return int returnValue) { ... return returnValue/5; } This advice is applied to a joinpoint that returns an int value. Notice that it receives the value returned by the joinpoint (or by an advice that has executed before this one, if there are other advices involved), and returns one fifith of its value. Our next advice: public List afterUnmodifiableList(@Return List returnValue) { ... return Collections.unmodifiableList(returnValue); } Intercepts POJO.getList() method, that returns a java.util.List object. The same return type is used by this advice, that overwrites the joinpoint return value with an unmodifiable version of the original list. Since after advices are not enforced to return values, afterVoid advice, of type void, can be used to intercept any joinpoint, no matter wheter the joinpoint has a return value or not: public void afterVoid() { ... }