diff options
authorahaase2008-02-25 07:48:10 (EST)
committerahaase2008-02-25 07:48:10 (EST)
commit3a60a195e463ff1138d904dae4ebfbbe9d835c4a (patch)
parentbcde5284f6d93acd376d3e5a652fb09dfc8bf81a (diff)
reversed the order of advice application - last registered is now the innermost wrapper around the advised function
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/aop/ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/aop/
index a5e0de2..01b2547 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/aop/
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/aop/
@@ -62,8 +62,13 @@ public final class AdviceContextImpl implements AdviceContext {
public AdviceContextImpl copyWithAdvice (AroundAdvice advice) {
- // the result cache survives the addition (and going out-of-scope!) of advice. This
- // is possible because newly applied advice is applied "around" advice applied earlier.
+ // Advice is applied in the order of registration: Last applied is the innermost. That
+ // means that the application of new advice invalidates the entire cache. It might
+ // be possible to fine-tune this, invalidating only those parts of the cache that are
+ // directly affected by the newly registered advice, but that would mean very complex
+ // semantics, possibly significant performance impact and would be difficult to specify
+ // precisely (or rather, implement according to a precise specification) because of
+ // the complexities of wildcard matching.
final AdviceContextImpl result = new AdviceContextImpl (_resultCache);
result._advice.addAll (_advice);
@@ -75,9 +80,9 @@ public final class AdviceContextImpl implements AdviceContext {
//TODO test this (including the order in which advice is applied)!!!
- * returns the advice to be applied to this function, starting with the innermost
- * advice, i.e. the advice that is to be directly applied to the result of the
- * advised function.
+ * returns the advice to be applied to this function, starting with the outermost
+ * advice, i.e. the advice that is to wrapped around all other advice applicable
+ * to a given function.
public AdvisedFunction getAdvice (String functionName, Function f) {
return _advisedFunctionCache.get (functionName, f);