Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Why does every Aspect (pertarget(..)) addfieldsand interfaces to classes which are not targeted??

On 09/02/06, Jody Brownell <jody.brownell@xxxxxxxxxx> wrote:
> Great! That works... however - my original point cut should have worked
> as well according to the online docs.

Well ... your original pointcut did work - the resultant code would
behave as expected, it just happened to not be optimal.

> I certainly don't mind using your suggested pcd - I am always in favor
> of being more explicit where possible.
>
> Can I log a bug against this somewhere - assuming of course it is a bug.

You can log a bug, if for no other reason than we should provide
better docs on this - the fact that I can't explain succinctly why my
suggestion fixed the problem means there is something to sort out ;) 
I have an idea on how to possibly get to the optimal solution using
your within pointcut, and I'll try to implement it under the bug.  It
is all to do with our order of evaluating pointcuts and determining
when to add the interface.  Sometimes we don't know things early
enough in the process and add the interface 'because we might need
it'.

> Also - in an attempt to further simplify the PCD you gave me, I tried to
 > use
 >
 >           pointcut readLock(): @withincode(Lock.Read) && @within(Lock);
 >           pointcut writeLock(): @withincode(Lock.Write) &&
 > @within(Lock);
 >
 > In this case - I end up not advising anything at all - even though the
 > docs say it should be almost identical... but inclusive of constructors
 > as well.
 >
 > Another bug or am I misunderstanding? Thoughts?
I need to think about this one ... I'm not sure this is quite what you
want anyway, as @withincode() will be selecting all the join points
inside the annotated method, rather than just the method-execution
join point. Like you, I'm confused if this didn't match anything at
all.

 > Not trying to pick - just trying to get a solid grasp of
 > features/functionality/bugs before I make any recommendations for
 > including in team development toolkits.
 >
 > Does anyone have a rough idea of the adoption of aspectj 1.5 thus far? I
 > am Interested to hear about various peoples experience with it and this
 > version of AJDT.

The annotations capabilities are proving very popular.  Generic
aspects will take rather longer to take off.  The annotations support
has been out for 9 or 10 months and has a good deal of testing in the
field.  I imagine peoples comments on AJDT will be the usual:
- uses too much memory
- takes too long to compile
Both of which we are now focussing on now that integration of Java5
into AspectJ is complete.

Andy.


Back to the top