Community
Participate
Working Groups
This does /not/ occur all the time -- not even for the same file. I don't how I get into the state where this exception is thrown. However, doing a clean-rebuild seems to clear it up. ---- java.lang.ClassCastException: org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType at org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType(BcelWorld.java:414) at org.aspectj.weaver.bcel.BcelWeaver.getClassType(BcelWeaver.java:1135) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:947) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:286) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:165) at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:70) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:368) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:727) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:229) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:147) at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:116) at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)
Passing over to AspectJ
try and look at it for m3. will be tricky to debug without more info - might need to put trace into the weaver and ship a debug build.
Ok ... for any ReferenceType (String/Integer/List/etc) there is a delegate which can answer real questions about the reference type (whats your superclass? what are your methods?) Delegates fit the interface ReferenceTypeDelegate and there are two possible implementations of this interface. 1. BcelObjectType - this is the delegate used when the code for the reference type is recovered from bytecode (from a .class file) 2. EclipseSourceType - this is the delegate used when the source for the referencetype was passed in to the front end compiler (and so we haven't needed to go the bytecode) In this failure case we have accessed the delegate for a reference type assuming it is a BcelObjectType but in fact it is an EclipseSourceType. Now, with all the generics changes recently, Adrian and I have changed processing for referencetypes and their delegates. We *may* have inadvertently fixed this... needs a retry when we upgrade AJDT with an AJ build.
not generics related, bumping to M4
Fixed a while ago, this can't happen any more. If the delegate for a type is not a bcelObjectType then getBcelObjectType returns null and the caller is expected to deal with it. Quite frequently during incremental compilation we go digging for reweavable state that may have been stashed for a type - and that leads to this classcastexception because we happen to be processing an eclipse source type. Given that an eclipsesourcetype delegate can't have reweavable state we simply allow for null to occur from getBcelObjectType() and assume that means there is no reweavable state.