Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Capturing setting inside List

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, André.

> Is it possible to intercep this pointcut using AspectJ?

No, unfortunately not directly. This comes again down to tracking temporal
behaviour, which I described in earlier postings as trace matching or
stateful aspects.

Adrian blogged the other day about a general approach to that using finite
state machines (automata) and just today I added some stuff about how this
can be extended to tracking objects. The quick answer is: In general you
cannot do it with little effort without a language extension. If you have
only one specific case, you might however use a clever combinations of
pointcuts and hashmaps to do what you want.

I am currently developing a tool, which extends the AspectJ pointcut language
with temporal operators:

B b:
G( call(List.add(Object)) && args(b) && F( call(B.setX(..)) && target(b)) )

This means: For any object b of type B: *G*lobally when b is passed in to
List.add(Object) and *F*inally setX(..) is invoked on *that very* object b,
then do something...

Similar functionality is provided with tracematches (kinda regular
expressions) which will shortly be available in abc. See

http://www.aspectbench.org

Adrian's Blog:
http://www.aspectprogrammer.org/blogs/adrian/2005/04/aspects_as_auto.html

My Blog:
http://www.bodden.de/blog/

Hope that helps,
Eric

- --
Eric Bodden
Chair for programming languages and program analysis
RWTH Aachen University
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQFCX4JGzCIUKbtGVYIRAuQAAKCw+fQbytrUwMl44PX99SyXbs6b1wCfb+e7
miUqlVuIFfJyKpV0hyUejTY=
=w0Eu
-----END PGP SIGNATURE-----




Back to the top