Unfortunately that information is not preserved in an easily accessible way in woven class files. You can collect the weaveinfo messages at weaving time, which give you everything you need, but once weaving is complete you can only determine what aspects are affecting a type (but you'd still need to dig into the attributes the weaver attached to the bytecode). To recognize the affected join points you'd need to unpick the advice calls, which wouldn't be trivial, but is doable - this too would require going through the bytecode, you can't just do it via any kind of reflection. ITDs on the other hand, you can use a weave time flag that will attach annotations to the affected types which can then be reflected upon via the AjType system ( http://www.eclipse.org/aspectj/doc/next/aspectj5rt-api/org/aspectj/lang/reflect/AjType.html ).
And when I mean the bytecode, I mean the bytecode for the affected class. The aspect itself doesn't store a list of places where it applies - if it did then everytime a new type was affected the aspect would need modifying (even if the source for it hadn't changed) and we try to avoid doing that. It would be possible to turn weave info messages into some kind of file that travelled alongside the woven code that could then be loaded by Java code later (to discover what was woven were). Sorry I don't have an easy solution for you. cheers, Andy On 2 November 2011 00:07, Reza Parizi <[email protected]> wrote: > Hi, > > Given an advice A, how is it possible to write a Java program (perhaps by > using the current AspectJ and/or AJDT APIs) to find out what classes and > within each class, what elements (i.e. join points) are advised by A? > > Technically, the pointcut(s) associated with the advice A is able to tell us > what the advised join points and their affected classes are. However, > obtaining this kind of crosscutting relationships information in automated > manner is probably non-trivial, where I am looking a solution for it. > > Thanks in advance, > > ~parizi > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
