Bug 36747 - weaving information via messages
Summary: weaving information via messages
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: 1.2.1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-22 05:58 EDT by Martin Lippert CLA
Modified: 2012-04-03 16:14 EDT (History)
0 users

See Also:


Attachments
simple WovenMessage implementation (3.75 KB, patch)
2003-04-22 06:00 EDT, Martin Lippert CLA
aclement: iplog+
Details | Diff
messages for type mungers (999 bytes, patch)
2003-05-08 04:52 EDT, Martin Lippert CLA
aclement: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Lippert CLA 2003-04-22 05:58:48 EDT
Hi,

for the dynamic weaving functionality I implemented for the Eclipse runtime I
need to know which aspect got woven into which class. Therefore it would be good
if the weaver would generate messages during the bytecode weaving. Those
specialized messages could contain information for the aspect and the class.
I implemented a special subclass of Message and added the creation of the
message to the BcelAdvice class (a simple test case for this as well). Take a
look at the patch for details. I used the Message.INFO kind for this to not
modify the IMessage interface. It might be better to have a special
IMessage.Kind for that, something like "WOVEN".
I think there are more places (in addition to BcelAdvice.implementOn(..)) where
this kind of information should be generated, but I am not familiar enough to
implement them all.
Comment 1 Martin Lippert CLA 2003-04-22 06:00:06 EDT
Created attachment 4661 [details]
simple WovenMessage implementation
Comment 2 Martin Lippert CLA 2003-05-08 04:52:56 EDT
Created attachment 4820 [details]
messages for type mungers

I added the message generation to the BcelTypeMunger class to get messages if
only types are changed by the weaving process.
Comment 3 Adrian Colyer CLA 2004-02-19 10:11:18 EST
This is related to bug 44415
Comment 4 Andrew Clement CLA 2004-05-10 12:18:16 EDT
I'm appending to the bug rather than sticking this on the aspectj-dev list to 
limit the exposure until its had a bit of testing.  It is quite a messy patch 
so I have built a distribution of aspectj with support in for weaving 
messages. I hope thats ok for you...
You can get it here:

http://download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT-
WEAVEINFO.jar

(The level of AspectJ is actually 1.2rc2 inside there)

I'd appreciate any feedback on it, log any problems with it in this bug report 
rather than raising real bugs yet.  I've tested it for source/binary weaves 
and for cases when binary weaves are missing debug information.  But, no doubt 
I've missed something!  And this afternoon I had a go at extending the 
messages to indicate whether there is dynamic residue for an advice match 
(i.e. has a runtime test been added to the code).  For the tjp demo in aspectj 
examples I get:
C:\aspectj1.2\doc\examples\tjp>ajc -showWeaveInfo *.java
Type 'tjp.Demo' (Demo.java:20) advised by around advice from 'tjp.GetInfo' 
(GetInfo.java:26) [RuntimeTest=true]

Type 'tjp.Demo' (Demo.java:30) advised by around advice from 'tjp.GetInfo' 
(GetInfo.java:26) [RuntimeTest=true]

Type 'tjp.Demo' (Demo.java:34) advised by around advice from 'tjp.GetInfo' 
(GetInfo.java:26) [RuntimeTest=true]

(The related pointcuts include cflow, hence runtime test is 'true')

-showWeaveInfo is the command line option to switch it on.

showweaveinfo="true" is the IAJC ANT task option to switch it on.

You will get messages for: 
before/after/around/afterreturning/afterthrowing/declareparents/declaresoft 
and ITDs.

One situation where it may misbehave at the moment is if you use your own 
message handlers...
Comment 5 Martin Lippert CLA 2004-05-14 16:53:51 EDT
The binary distribution is a bit complicated for me since I have to include the
source of the weaver into my project to use it.
Nevertheless the output seems to provide all necessary information. Would be
nice to have a simple api to extract the information (class name and aspect
name) from the messages.
Comment 6 Andrew Clement CLA 2004-08-06 03:30:37 EDT
Available in build (phew):

BUILD COMPLETE -  build.327
Date of build: 08/05/2004 17:51:19
Time to build: 93 minutes 33 seconds
Last changed: 08/05/2004 17:20:15
Latest good AspectJ jar available at:
download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar

I'll resolve this as fixed for now (just to get the bug numbers down!).  If you
try it and decide you definetly need to extract info from the messages, I'll
accept an enhancement request for that ... :)
Comment 7 Martin Lippert CLA 2004-10-03 16:14:38 EDT
I took a closer look at your implementation and there is only one tiny little
thing that is missing (to make it suitable for my needs). The class WeaveMessage
should provide a method to get the full-qualified name of the aspect it refers
to. Thats all. ;-)
Comment 8 Adrian Colyer CLA 2004-10-21 04:32:41 EDT
Fix released as part of AspectJ 1.2.1