Home » Language IDEs » AspectJ » PointCut and Advice to "new" object
|
Re: PointCut and Advice to "new" object [message #46023 is a reply to message #45974] |
Wed, 12 January 2005 20:36 |
Eclipse User |
|
|
|
Originally posted by: newsserver_mails.bodden.de
On Wed, 12 Jan 2005 14:37:46 +0000 (UTC), Harry Sheng wrote:
> How should I write the pointcut and advice? It seems I could only get
> either one instance, not both.
You need a call pointcut with after returning advice and can then expose
the caller using this(a) and the new Object using target(b) I believe...
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
How to remove incorrectly marked bad secotrs on NTFS...
http://bodden.de/misc/ntfsrecovery/
|
|
| |
Re: PointCut and Advice to "new" object [message #46168 is a reply to message #46052] |
Sat, 15 January 2005 20:42 |
Eclipse User |
|
|
|
Originally posted by: newsserver_mails.bodden.de
On Thu, 13 Jan 2005 14:50:33 +0000 (UTC), Harry Sheng wrote:
> In this advice, the thisJoinPoint.getTarget() returns NULL. Tried the
> before and around advices, the same result. Should not it be the "caller"?
No. For a call pointcut the target is the object being called. However, in
this specific case, due to a compiler limitation, the called object is not
yet known (since it is still about to be created). Thus you will get null.
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
Arithmetic Coding - educational example code and more
http://ac.bodden.de/
|
|
| |
Re: PointCut and Advice to "new" object [message #46315 is a reply to message #46286] |
Mon, 17 January 2005 12:15 |
Eclipse User |
|
|
|
Originally posted by: newsserver_mails.bodden.de
On Mon, 17 Jan 2005 09:28:14 +0000 (UTC), Matthew Webster wrote:
> I don't think this is a compiler limitation unless you consider
> clairvoyance i.e. knowing in advance what object is to be allocated a
> genuine feature ;-).
In an *after* advice, the object should be known, shouldn't it?
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
How to remove incorrectly marked bad secotrs on NTFS...
http://bodden.de/misc/ntfsrecovery/
|
|
| |
Re: PointCut and Advice to "new" object [message #46403 is a reply to message #46344] |
Mon, 17 January 2005 17:09 |
Eclipse User |
|
|
|
Originally posted by: newsserver_mails.bodden.de
On Mon, 17 Jan 2005 13:49:00 +0000 (UTC), Matthew Webster wrote:
> Please see this thread
> ( http://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg01149.ht ml)
> concerning return values at join points, especially Gregor's response. The
> object created by a call to new is not a property of the join point either.
Ok, I see the connection. So do I understand correctly, that technically it
would actually be possible to expose the object in this specific context,
but since such arguments are only exposed when they exist while entering
*and* leaving the joinpoint, they are not exposed?
Cheers,
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
Arithmetic Coding Revealed - a comprehensive guide to AC
http://bodden.de/studies/publications/pub_ac_en/
|
|
| | | |
Re: PointCut and Advice to "new" object [message #585829 is a reply to message #46052] |
Sat, 15 January 2005 20:42 |
Eric Bodden Messages: 32 Registered: July 2009 |
Member |
|
|
On Thu, 13 Jan 2005 14:50:33 +0000 (UTC), Harry Sheng wrote:
> In this advice, the thisJoinPoint.getTarget() returns NULL. Tried the
> before and around advices, the same result. Should not it be the "caller"?
No. For a call pointcut the target is the object being called. However, in
this specific case, due to a compiler limitation, the called object is not
yet known (since it is still about to be created). Thus you will get null.
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
Arithmetic Coding - educational example code and more
http://ac.bodden.de/
|
|
| | | |
Re: PointCut and Advice to "new" object [message #585930 is a reply to message #46344] |
Mon, 17 January 2005 17:09 |
Eric Bodden Messages: 32 Registered: July 2009 |
Member |
|
|
On Mon, 17 Jan 2005 13:49:00 +0000 (UTC), Matthew Webster wrote:
> Please see this thread
> ( http://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg01149.ht ml)
> concerning return values at join points, especially Gregor's response. The
> object created by a call to new is not a property of the join point either.
Ok, I see the connection. So do I understand correctly, that technically it
would actually be possible to expose the object in this specific context,
but since such arguments are only exposed when they exist while entering
*and* leaving the joinpoint, they are not exposed?
Cheers,
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
Arithmetic Coding Revealed - a comprehensive guide to AC
http://bodden.de/studies/publications/pub_ac_en/
|
|
| |
Goto Forum:
Current Time: Wed Jan 15 14:47:00 GMT 2025
Powered by FUDForum. Page generated in 0.10201 seconds
|