Bug 117614 - ajc crashes on common-logging-1.0.4.jar
Summary: ajc crashes on common-logging-1.0.4.jar
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-22 20:57 EST by Michelle Xue CLA
Modified: 2005-11-29 15:18 EST (History)
1 user (show)

See Also:


Attachments
jar that causes compiler crash (37.12 KB, application/octet-stream)
2005-11-23 13:30 EST, Michelle Xue CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michelle Xue CLA 2005-11-22 20:57:51 EST
--- Dump Properties ---
Dump file: ajcore.20051122.152749.326.txt
Dump reason: org.aspectj.weaver.BCException
Dump on exception: true
Dump at exit condition: abort
---- Exception Information ---
org.aspectj.weaver.BCException: bad resolve of void org.apache.log4j.Category.log(java.lang.String, org.apache.log4j.Level, java.lang.Object, java.lang.Throwable)
	at org.aspectj.weaver.World.getModifiers(World.java:216)
	at org.aspectj.weaver.Member.getModifiers(Member.java:406)
	at org.aspectj.weaver.patterns.KindedPointcut.warnOnConfusingSig(KindedPointcut.java:109)
	at org.aspectj.weaver.patterns.KindedPointcut.match(KindedPointcut.java:69)
	at org.aspectj.weaver.patterns.OrPointcut.match(OrPointcut.java:44)
	at org.aspectj.weaver.patterns.AndPointcut.match(AndPointcut.java:43)
	at org.aspectj.weaver.patterns.AndPointcut.match(AndPointcut.java:43)
	at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:62)
	at org.aspectj.weaver.Advice.match(Advice.java:91)
	at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:1126)
	at org.aspectj.weaver.bcel.BcelClassWeaver.matchInvokeInstruction(BcelClassWeaver.java:1115)
	at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:987)
	at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:827)
	at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:348)
	at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:83)
	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:742)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:707)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:634)
	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:577)
	at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:243)
	at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:118)
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:383)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:680)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:168)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:102)
	at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:109)
	at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
	at org.aspectj.tools.ajc.Main.run(Main.java:291)
Comment 1 Adrian Colyer CLA 2005-11-23 04:58:00 EST
Could you provide some details of the aspect that you were weaving with at the time please?

The compiler was trying to put out a message of the form "Did not match at join point <blah> because declaring type is XXX, use this(YYY) if match desired" if that helps you pin it down any.

Thanks, Adrian.
Comment 2 Michelle Xue CLA 2005-11-23 13:28:09 EST
I couldn't find the compiler message, "Did not match join point, ...."  It's not in the core dump or the message I get when I run ajc.

I also attached my common logging jar.

My point cut basically looking at log4J logging method and does something with it.

Thanks.

 pointcut actionLog4j(Object message):
	        (call(void org.apache.log4j.Logger.warn(Object))  ||
	        call(void org.apache.log4j.Logger.debug(Object)) ||
	        call (void org.apache.log4j.Logger.info(Object)) ||
	        call (void org.apache.log4j.Logger.error(Object))  ||
	        call (void org.apache.log4j.Logger.fatal(Object)))
	        && args(message);

	void around(Object message) : actionLog4j(message) {
//do something here
proceed(message);
}
Comment 3 Michelle Xue CLA 2005-11-23 13:30:18 EST
Created attachment 30497 [details]
jar that causes compiler crash
Comment 4 Adrian Colyer CLA 2005-11-24 10:15:02 EST
I didn't reproduce exactly the same failure as you are seeing, but I did get one very similar at the same point in the code. The problem (that I am seeing) was caused by a commons-logging.jar containing code compiled against a version of log4j.jar that doesn't exactly match the one on my classpath. In particular, part of the commons-logging code (that obviously never gets executed at runtime) calls a method on a Log4j type that doesn't exist. The compiler fell over when trying to put out an error message. It now copes with the missing method. When a build comes through with this fix in I'll ask you to try again if that's ok and make sure that it solves the problem in your environment too.

As an added bonus, the "cantFindType" messages that come out when you weave into commons-logging.jar (for reasons such as those described above) are by default error messages that stops you in your tracks even though in this case you could safely ignore them. I've made them into lint messages so that you can control the severity (in this case using e.g. -Xlint:ignore) and thus still get useful results in the absence of missing types.
Comment 5 Adrian Colyer CLA 2005-11-24 15:50:18 EST
build now available from the aspectj downloads page - please could you test out this fix in your environment and let me know what happens? 

Thanks, A.
Comment 6 Adrian Colyer CLA 2005-11-29 15:18:58 EST
I'm moving this to "fixed" as I'm pretty confident that the changes we put in should have resolved this issue. However, if you do find that there is still an issue in the latest builds please reopen this report.

Thanks, Adrian.