Community
Participate
Working Groups
I try to run ajc on hibernate3.jar with option "-injars", "-outjars" programatically. And I check IMessage, it says something advised by something, so it shows that it's weaving, but it didn't weave anything into the jar. I also check IMessage.isAbort()||IMessage.isFailed(), it's false. However, IMessage.isError() is true, and the message is "cannot resolve ...". I know sometimes there is resolution problem, but I think it should still weave, otherwise, it shouldn't output message that some class is already advised by some pointuct.
What happens if you *don't* use -outjar ? do you find that you get *some* classes out, i.e. the ones that did successfully weave? If there is an error during weaving we don't produce an outjar if you use that option (I believe) - why would you want a half finished jar? Cannot resolve <type> messages come out when the compiler needs to know something in order to determine whether to advise something, if an incomplete set of types is supplied, the weaver cannot do its job correctly.
You mean if I don't use the option "-outjar", instead, I use option "-d", it will output the some classes that are successfully weaved? But is it a bug when "-outjar" output something, and the message says some code are being advised, but it's not actually weaved? User would think the jar is being weaved on the things that ajc says it did. I think ajc should output the jars that have the classes that are weaved successfully and the classes that are not weaved because of resolution problem. When ajc has some resolution problems, it just does not advice on things that it cannot resolve, which is fine, because it still does advice correctly on the things it can resolve. From my experience using aspectJ, the things it cannot resolve are the things I don't care. A use case would be I am using a third party jar, I want to weave something to it. There will definitely be resolution problem with third party library, however, I can see the ajc message and verify what's being advised, and decide if I am happy with it or not, and usually I am happy with the result even though ajc cannot resolve everything.
If the compile/weave fails with an error, then the user should not expect anything from the output since the process was halted. The messages about types being woven are produced as the process proceeds (esp. for debugging purposes), but they mean the types were affected but not necessarily output. Ideally, no classes would be produced either, but that's a different bug. We should perhaps document this. stalebug