As Alexander says, we probably need more to go on here. My attempts to
create what you are describing are just working, I fleshed out the sample
you included earlier and saw the weaving with/without any use of logger
from the advice.

> I would expect to see a message similar to this: "weaveinfo Join point
'method-call(java.lang.Object mypackage.someMethod(...))' in Type
'mypackage.MyAspect' (MyAspect.java:30) advised by around advice from
'anotherpackage.AsynchronousAspect' (from AsynchronousAspect.java))"

So you are using a pointcut like 'call(@Asynchronous * *(..))' ?  I find
'execution' pointcuts better usually (they weave less places) but whether
you can use them may depend on what code you have under your control.

Few things you can try:
- try code style rather than annotation style aspects, the latter has more
bugs than the former.
- try execution rather than call pointcuts

The log object being static won't make any difference, it certainly
wouldn't affect the compiler producing a weave info message - those are
printed at compile time in a static context.

There could well be a bug here but I won't be able to get to the bottom of
it without a bit more to go on.

cheers,
Andy



On 12 March 2013 05:32, Alexander Kriegisch <alexan...@kriegisch.name>wrote:

> No need to apologise, Jaco. But providing a concise example reproducing a
> problem saves a lot of time and provides for deeper understanding on your
> side as well as ours. The pros like Andrew  Eisenberg or Andy Clement can
> quickly pinpoint your problem and in case of a bug even re-use your code as
> a test case for the test suite (at the moment every AJDT build runs >1000
> tests, for example).
>
> Often when trying to reduce a problem to a minimal form already helped me
> spot my own errors. So when I am asking for something like that, it is not
> in order to nag you. :-)
>
> Kind regards
>
> Alexander Kriegisch
>
> Am 12.03.2013 um 12:26 schrieb Jaco le Roux <jabal...@gmail.com>:
>
> > Again, my apologies. I cannot simply copy and paste the code in here.
> > I will take some time to write up something in github that exhibits
> > the same behaviour, but this may take a while :) I was hoping perhaps
> > there is something obvious I missed, with respect to logging or
> > advice, something I don't understand. Thank you for the help
> > nonetheless. I will get back to you with a more concrete example.
> >
> > On Tue, Mar 12, 2013 at 1:03 PM, Alexander Kriegisch
> > <alexan...@kriegisch.name> wrote:
> >> LOL, now you are asking us to help you with your pointcut and advice
> which still you have not provided. Sorry, I really wanted to help, but I
> like you to make it a bit easier for me to help by not letting me guess
> what might be the problem, but verify hard facts. Can you provide something
> I can actually compile and run?
> >>
> >> Alexander Kriegisch
> >>
> >> Am 12.03.2013 um 11:34 schrieb Jaco le Roux <jabal...@gmail.com>:
> >>
> >>> Apologies. It was 1:30am and I think my brain turned to jelly after a
> >>> long day of doing computery things :)
> >>>
> >>> Here is a sample aspect I am building:
> >>>
> >>> @Aspect
> >>> @Configurable
> >>> public class MyAspect {
> >>>   private static final Log log = LogFactory.getClass(MyAspect.class);
> >>>   // Autowired dependencies
> >>>
> >>>   // Pointcuts and advice
> >>>
> >>>   // Happens to be a pointcut of some other Advice
> >>>   @Asynchronous
> >>>   private Object someMethod(...) {
> >>>   }
> >>> }
> >>>
> >>> My package depends on another library that defines an Aspect which
> >>> cuts across methods annotated with @Asynchronous. Therefore, during
> >>> ajc compilation, I would expect to see a message similar to this:
> >>> "weaveinfo Join point 'method-call(java.lang.Object
> >>> mypackage.someMethod(...))' in Type 'mypackage.MyAspect'
> >>> (MyAspect.java:30) advised by around advice from
> >>> 'anotherpackage.AsynchronousAspect' (from AsynchronousAspect.java))"
> >>>
> >>> But... I don't. The fun part is that when I add a simple log line to
> >>> my @Around advice in the MyAspect class, then the ajc compiler picks
> >>> up the @Asynchronous aspect and weaves it correctly. Why would adding
> >>> a simple thing like logging change my assumptions?
> >>>
> >>> On Tue, Mar 12, 2013 at 12:05 PM, Alexander Kriegisch
> >>> <alexan...@kriegisch.name> wrote:
> >>>> Would you mind providing some minimal sample code to reproduce the
> situation? It is always a good idea to provide the code you ask others to
> help you fix. ;-)
> >>>>
> >>>> Alexander Kriegisch
> >>>>
> >>>>
> >>>> Am 12.03.2013 um 00:23 schrieb Jaco le Roux <jabal...@gmail.com>:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> I have an Advice class that declares a method that happens to be a
> >>>>> pointcut for other advice. My advice class also has a reference to a
> >>>>> static log object. If I print something to the log as part of some
> >>>>> @Around advice, the point-cuts are all setup correctly. If I comment
> >>>>> this line out, then the method that is a point-cut of the other
> advice
> >>>>> is no longer weaved during compile time (the log message "weaveinfo
> >>>>> Join point 'method-call(...)' in type '..' advised by around advice"
> >>>>> no longer appears).
> >>>>>
> >>>>> Why is that my advice doesn't trigger when I don't print to this log
> >>>>> file? Does it have to do with the fact that the log object is static
> >>>>> and perhaps forces the Aspect class to be instantiated at a different
> >>>>> point?
> >>>>>
> >>>>> Any advice (excuse the pun) appreciated!
> >>>>> _______________________________________________
> >>>>> aspectj-users mailing list
> >>>>> aspectj-users@eclipse.org
> >>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >>>> _______________________________________________
> >>>> aspectj-users mailing list
> >>>> aspectj-users@eclipse.org
> >>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >>> _______________________________________________
> >>> aspectj-users mailing list
> >>> aspectj-users@eclipse.org
> >>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >> _______________________________________________
> >> aspectj-users mailing list
> >> aspectj-users@eclipse.org
> >> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@eclipse.org
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to