Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] One target for intertype declarations



David,

ITDs and per-object aspects both address the need to associate new state
with an object. Which you choose depends on whether the state logically
belongs to the object (and is probably accessed by inter-type methods) or
the aspect. The per-object approach also allows conditional creation of the
state at runtime.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

David Pearce <david.pearce@xxxxxxxxxxxxx>@eclipse.org on 18/11/2004
22:26:28

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    aspectj-users@xxxxxxxxxxx
cc:
Subject:    Re: [aspectj-users] One target for intertype declarations


Hi Matthew,

> No. A reference to the aspect is held in the target object (introduced by
> the compiler rather like an ITD) so the aspect will automatically be
> garbage collected at the same time as the object.

That's interesting.  So, is there any actual difference between using an
ITD instead of pertarget?  Is the reference put into all objects
matching the pertarget pointcut, or just into objects for which an
aspect is created?

Cheers,

Dave

> Matthew Webster
> AOSD Project
> Java Technology Centre, MP146
> IBM Hursley Park, Winchester,  SO21 2JN, England
> Telephone: +44 196 2816139 (external) 246139 (internal)
> Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
> http://w3.hursley.ibm.com/~websterm/
>
> David Pearce <david.pearce@xxxxxxxxxxxxx>@eclipse.org on 11/11/2004
> 03:51:06
>
> Please respond to aspectj-users@xxxxxxxxxxx
>
> Sent by:    aspectj-users-admin@xxxxxxxxxxx
>
>
> To:    aspectj-users@xxxxxxxxxxx
> cc:
> Subject:    [aspectj-users] One target for intertype declarations
>
>
> Hi all,
>
> I would just like to confirm something regarding the elimination of
> "multi-intertype declarations".  Basically, I want to add a field to
> every object instance.  So, perviously, I could have just used something
> like:
>
> aspect A {
>          public int *.theField = 0;
> }
>
> But, since AspectJ 1.1 this syntax is no more.  So, now my question.  Is
> the pertarget specifier supposed to be used instead of the above now?  I
> realise that the README-11.html indicates pertype should be used for
> static field member introduction (if it existed, that is), so I figure
> the reasoning is the same.
>
> Also, how is pertarget actually implemented?  Does it involve some kind
> of hashmap lookup or not?  If not, then what?
>
> Any help would be appreciated!
>
> David J. Pearce
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top