Cheers,
Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming
m: 520 591-1849
Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt
Articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv
On Nov 11, 2004, at 4:56 PM, David Pearce wrote:
Hi Wes,
aspect A {
interface I {}
declare parents : my.packages..* implements I;
int I.theField = 2;
Actually, this pattern is rather interesting to me! I had tried
something like it, but instead including the "int theField" inside the
interface declaration itself. This caused problems when I tried to
modify it, since the field was regarded as final. In fact, I'm
slightly unsure why the above works ?
Anyway, it doesn't actually solve my problem since I want to add
fields to *all* objects. I tried the following:
declare parents : * implements I;
Which causes some "typeNotExposedToWeaver" warnings and the following
error:
> [error] can''t change the parents of java.lang.Object
I wonder, is there anyway to say "everything except java.lang.Object" ?
Cheers,
Dave
------------Original Message------------
From: David Pearce <david.pearce@xxxxxxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Wed, Nov-10-2004 7:55 PM
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
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users