> I'm making some exercises to learn AspectJ and I'm not able to define a
> pointcut that captures the main method.
[quoted text clipped - 10 lines]
> Why does the pointcut capture all public static methods with void return
> type except for the main method?
The call join point picked out by your pointcut happens outside the
target method. In order to implement that for main() method, AspectJ
should be able to modify the code of the JVM which invoked your main().
Use the execution join point instead.
See also:
http://www.eclipse.org/aspectj/doc/released/faq.php#q:comparecallandexecution
piotr
Chris Uppal - 09 Nov 2006 14:52 GMT
> The call join point picked out by your pointcut happens outside the
> target method. In order to implement that for main() method, AspectJ
[quoted text clipped - 3 lines]
> See also:
> http://www.eclipse.org/aspectj/doc/released/faq.php#q:comparecallandexecution
Interesting. I hadn't realised that AspectJ distinguished between the inside
and outside of a method call (as it were). It's a good idea. (Still doesn't
make me less sceptical about the AspectJ vision of AOP, though).
In this case the main() entry point is invoked directly from JNI [*] -- which
does make it difficult for bytecode manipulation to replace ;-)
([*] That's to say, it's not -- strictly speaking -- built into the JVM).
-- chris