Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Need to enumerate all methods for selected advices of an aspect

Hi -

-messageHolder is not in 1.5.0, but should be in the latest dev build
on the downloads page:

  http://www.eclipse.org/aspectj/downloads.php
  http://www.eclipse.org/downloads/download.php?file=/technology/aspectj/dev/aspectj-DEVELOPMENT-20060303105327.jar

(But I can't say I've tested it myself.)

Even in 1.5.0 you can programmatically invoke ajc.Main.  The example at
the bottom of the ajc section of the devguide shows how to specify a
message handler/holder - I've copied it below.

btw, another option is to use the -crossrefs option to generate a .ajsym file
and then interpret that. 

Wes

http://www.eclipse.org/aspectj/doc/released/devguide/ajc-ref.html

-----------------------------------
import org.aspectj.bridge.*;
import org.aspectj.tools.ajc.Main;
import java.util.Arrays;

public class WrapAjc {
  public static void main(String[] args) {
    Main compiler = new Main();
    MessageHandler m = new MessageHandler();
    compiler.run(args, m);
    IMessage[] ms = m.getMessages(null, true);
    System.out.println("messages: " + Arrays.asList(ms));
  }
}

> ------------Original Message------------
> From: "András Imre" <andras.imre@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Fri, Mar-3-2006 7:15 PM
> Subject: Re: [aspectj-users] Need to enumerate all methods for selected advices of an aspect
>
> Guys, thanks for help.
> 
> Filtering weave info from the ajc output seems feasible.
> 
> However, I did not succeed with the messageholder/handler
> implementation. Aspectj 1.5.0 compiler does not recognize the
> -messageHolder switch for me on win2003.
> 
> Tried to download source for 1.5.0, and found no single file,
> just CVS web interface. Looked up the switch in source of
> org.aspectj.tools.ajc.Main.java. It does exist but does not work
> for me:
> 
> --- command ---
> ajc -messageHolder MyMessageHolder -showWeaveInfo Hello.java
> Security.aj AbstractAspect.aj
> 
> --- output ---
> [error] unrecognized single argument: "-messageHolder"
> 
> [error] no sources specified
> ...stripped compiler help
> 
> Here I gave up, as found no info or example about how to use this 
> switch
> and how to proceed with holder/handler implementation.
> 
> Anyway, AspectJ is great, but its not easy to get to the point
> in the source.
> 
> 
> Thanks,
>   András
> 
> 
> >It is possible to use your own message handler which will
> >then get callbacks for 'weave info' messages.  To see the kind
> >of information you would get, turn on weave info messages
> >in the AJDT options panel or pass -showWeaveInfo to the
> >compiler.  If it looks like what you want, write an implementation
> >of IMessageHolder and pass the class name with
> >-messageHolder to the compiler ... I think that will work, although
> >I've not tried it !!
> >
> >Andy.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 



Back to the top