Thank you for the replies.
Your solution is very interesting Andy!

From: Andy Clement [via AspectJ] 
[mailto:[email protected]]
Sent: Sunday, November 18, 2012 12:45 PM
To: Khanzada, Amil
Subject: Re: Counting # of Methods/Classes

Marko is right that this isn't normally an AspectJ usage, but I guess
you could achieve it with this aspect:

aspect X {
  before(): execution(* *(..)) {}
}

ajc X.aj -inpath somecode.jar -showWeaveInfo | grep "advised by" | wc -l

So I'm producing weaving messages as I weave some code then counting
the number of messages.

cheers,
Andy

On 17 November 2012 05:36, Marko Umek <[hidden 
email]</user/SendEmail.jtp?type=node&node=4650624&i=0>> wrote:

> Hi Hmil,
>
> This is not a question of AspectJ. You should read the classes directly from
> the JAR-Files (CLASSPATH), load each class and then do some reflection:
>
> for( String filename : <content of class.path> )
> {
>      Class
> theClass=Class.forName(filename.replace(".class","").replace("/","."));
>      Method[] methods=theClass.getDeclaredMethods();
>
>     countClasses++;
>     countMethods+=methods.length;
> }
>
> You can do this with AspectJ, but you still have to load each class: Aspects
> do not apply on none loaded classes.
>
> Regards Marko
>
>
>
> --
> View this message in context: 
> http://aspectj.2085585.n4.nabble.com/Counting-of-Methods-Classes-tp4650617p4650618.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> [hidden email]</user/SendEmail.jtp?type=node&node=4650624&i=1>
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
[hidden email]</user/SendEmail.jtp?type=node&node=4650624&i=2>
https://dev.eclipse.org/mailman/listinfo/aspectj-users

________________________________
If you reply to this email, your message will be added to the discussion below:
http://aspectj.2085585.n4.nabble.com/Counting-of-Methods-Classes-tp4650617p4650624.html
To unsubscribe from Counting # of Methods/Classes, click 
here<http://aspectj.2085585.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4650617&code=YW1pbEBocC5jb218NDY1MDYxN3wtOTMyMjQ1NzQ0>.
NAML<http://aspectj.2085585.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://aspectj.2085585.n4.nabble.com/Counting-of-Methods-Classes-tp4650617p4650628.html
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to