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??

So far - my experience with AJDT is ok. I am experiencing some unusual
and seemingly random exceptions (mostly NPE and classcast). Trying to
isolate so I can log a bug with a test case. ANYWAY - I am thoroughly
impressed with all I have seen so far.

Annotations truly provide a loose model on which to cross cut functions.
I found early on with previous versions of aspectj designing aspects
around method signatures and interfaces to rigid (maybe coupled is a
better term) and introduced more complexity through somewhat hidden
behavior. But annotations feel like very a natural vehicle and have the
flexibility to be placed on any a multitude of constructs - definitely
the model I was waiting for.... functional and self documenting.

When an engineer annotates a construct with @Something - they intend on
inheriting a certain behavior... 

Interesting thought - it would be nice to be able to declare precedence
for aspects using the natural order of annotations as they appear on the
particular construct which it is bound. That would further decouple the
aspect and allow for more fluid frameworks to be built. That way,
aspects are applied as functional frameworks _without_ policy. Maybe
that is done naturally by the weaver - I will have to play some more :)

Thanks for the help - I will log a bug sometime today.


-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: Friday, February 10, 2006 3:59 AM
To: aspectj-users@xxxxxxxxxxx
Subject: 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.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top