[abc-users] RE: [aspectj-users] pertarget anomaly (was: bug with pertarget?)

From: Eric Bodden <eric@bodden.de>
Date: Tue Nov 23 2004 - 22:50:04 GMT

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

David Pearce wrote:
> Hi all,
>
> Well, i'm still chasing up a few things regarding use of pertarget.
> One thing I want to do is associate state with objects which are
> constructed and then monitor modifications to their fields. The
> following gives an
> example:
>
>> public aspect taspect pertarget(call(*.new(..)) &&
>> !within(taspect)) {
>>
>> after(Object o) : target(o) && call(*.new(..)) &&
>> !within(taspect) { System.err.println("CONSTRUCTING - " + o);
>> }
>>
>> after(Object o) : target(o) && set(* *.*) && !within(taspect)
>> { System.err.println("SETTING - " + o);
>> }
>> }
>>
>> public class test {
>> public int testField;
>>
>> public static void main(String argv[]) {
>> test t = new test();
>> t.testField = 0;
>> }
>> }
>
> However, this does not work - neither "CONSTRUCTING - ..." nor
> "SETTING - ..." messages are printed. According to Ramnivas Laddad
> in his reply to my previous mail on this topic (see "re: bug with
> pertarget?"), the reason for this is:
>
>> This is due to implicit limiting of join points when using any of
>> the per- associations. For pertarget() associations, the advice
>> application (or the scope of
>> aspect) is limited to where the join point's target object matches
>> the
>> aspect's associated object (target object at call(test.new(..))).

I am not sure, if I get it right, but I guess, the problem is that in
the current implementation, if you specify "pertarget", the target
object is passed to the instance field for inspection/exposure
immediately before the call (because immediately before the call the
target object of course cannot be altered any more). When using a
constructor, however, the object does not exist yet. So that's a
special case that *could* be handled but in fact is not here. I am
not sure, if ABC does (CC to them)... However I think this could and
should be handled in future releases. Maybe you or me should file a
feature request.

Eric

- --
Eric Bodden
Chair I2 for Programming Languages and Program Analysis
RWTH Aachen University

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3

iQA/AwUBQaO+m8wiFCm7RlWCEQLsFgCcDCJDO0P1f4KQAuIgzpLIlsZ2Yb4AoKXw
ymd02sb1bEeUINi3DR8g2LjK
=VrHF
-----END PGP SIGNATURE-----
Received on Tue Nov 23 22:54:47 2004

This archive was generated by hypermail 2.1.8 : Tue Nov 30 2004 - 23:50:03 GMT