Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Problem with an around advice being run "sometimes"

However, if I am not mistaking AJDT 1.4 uses AspectJ 1.5.2 whereas AJDT uses
AspectJ 1.5.1,
so it might not be comparable? (There was actually a thread "syncing AJDT
with AspectJ build?" in eclipse.technology.ajdt started by Barry Kaplan
recently where him, me and M Chapman discussed this issue. Don't know if
there is an enhancement request for it. Otherwise I gladly file one since in
my case I use Eclipse  + Maven Eclipse Plugin for development but Maven only
to generate releases, so sync between AspectJ versions is of essence.)

We already have enhancements open to cover this.  AJDT1.3.2 builds are
available for Eclipse 3.1 - and these include AspectJ1.5.2.


No other aspect constructs at all. This is the ONLY aspect in the whole
system/project.
I can send you the source code of the Transactional annotation if you want.

I've been trying to recreate this but it just always works for me
(typical) - maybe you can try upgrading to AJDT1.3.2 and see if that
makes any difference at all...  I presume your Transactional
annotation looks like this:

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface Transactional {
}

maybe with some member fields in it.  Can you try reducing the
complexity of your pointcut and seeing if there comes a point where it
reliably works every time?

If this is the original:

pointcut TRANSACTIONAL(Transactional transactionalAnnotation):
      execution(@Transactional * se.example..*(..))
      && @annotation(transactionalAnnotation) &&
      && this(MyInterface);

How about: (removing the annotation from the execution pcd)

pointcut TRANSACTIONAL(Transactional transactionalAnnotation):
      execution(* se.example..*(..))
      && @annotation(transactionalAnnotation) &&
      && this(MyInterface);

or maybe (removing @annotation - obviously the advice will need changing too)

pointcut TRANSACTIONAL():
      execution(@Transactional * se.example..*(..))
      && this(MyInterface);

or even (I know this may match too many places, but I just want to
know if it behaves reliably in matching correctly after every build).

pointcut TRANSACTIONAL():
      execution(@Transactional * se.example..*(..));

of course this is just to explore the problem a bit, I'm not proposing
that this is a fix.

After an incremental build occurs (and therefore the project won't run
successfully) - do you see the gutter annotations against the advice
disappear? then they return on the next full build?

I turned of the "No inline" option. No difference - still works every other
time or so.
The "No inline" option was suggested by Matt Chapman in the
eclipse.technology.ajdt news group thread "My Aspect is not run" when I
needed the execution to stop at break points in my around advice (same
advice that is causing problems now as well..).

that was a bit of a long shot on my part...

Andy.


Back to the top