Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] args() evaluation and around advice interaction

> The
> (invisible/implicit) AroundClosure parameter of an
> around advice seems to come in the way of args()
> matching.

Good observation...

You want to pick out an advice-execution join point based on
the number of arguments.  As you noticed, args does work
as intended, but there is an implicit parameter.

I believe one of the reasons that we do not name advice,
provide a signature for adviceexecution() to match, or
doc the args available at an advice-execution join point is
that we'd like to leave room for different implementations
of AspectJ to implement advice differently, and because
some (inline) implementations (e.g., of around advice) might
not present the join point context in the same way. I
wonder if we should document this policy, e.g., saying

  AspectJ does not require implementations to present
  arguments at the advice execution join point in the
  form they are declared in the advice, so using args(..)
  on advice-execution is not recommended.

It's worth submitting a bug, to either get the semantics
to commit to ignoring the implicit parameter or drive
something like this policy statement into the docs.

As a side note, another case of an implicit parameter in
Java is when the enclosing instance is passed to the
constructor of an inner class.

> Was surprised to find out that aspectJ 1.1.1
> has no provision to advice a mix of around and
> before/after advice, all defined to have same
> parameter types.

This is an overstatement; the issue is only with
using args() with adviceexecution().  All 1.x versions
of AspectJ can put all kinds of advice on a join point
using the same parameter types.

Thanks for bringing this up...
Wes

Devi Prasad wrote:
Hello

I have come across a puzzling behavior of aspectJ
1.1.1. Was surprised to find out that aspectJ 1.1.1
has no provision to advice a mix of around and
before/after advice, all defined to have same
parameter types.

More specifically, in the following sample, inside the
"other_aspect", if we replace args(x, y, ..) with
(just) an args(x, y), the around advice in "some_aspect" escapes interception. The
(invisible/implicit) AroundClosure parameter of an
around advice seems to come in the way of args()
matching. Is this the documented
behavior? If it so, isn't it somewhat annoying?

-------------------------------------------------------
aspect some_aspect {
pointcut call_m(int a, int b) : call(int test.m(..)) && args(a, b);

  before(int x, int y) : call_m(x, y) { ...  }
  int around(int x, int y) : call_m(x, y) { ... }
}

aspect other_aspect {
before(int x, int y) : adviceexecution() && within(some_aspect) && args(x, y, ..){ ...
      }
}
-------------------------------------------------------

Thanks



	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25ยข
http://photos.yahoo.com/ph/print_splash
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top