Bug 134371 - ClassCastException in AjState.recordClassFile()
Summary: ClassCastException in AjState.recordClassFile()
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-01 12:05 EST by Ron Bodkin CLA
Modified: 2012-04-03 16:15 EDT (History)
0 users

See Also:


Attachments
patch containing failing testcase (1.90 KB, patch)
2006-04-26 09:09 EDT, Helen Beeken CLA
aclement: iplog+
Details | Diff
patch containing proposed fix (3.30 KB, patch)
2006-04-27 04:39 EDT, Helen Beeken CLA
aclement: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2006-04-01 12:05:56 EST
I got this exception while working on a static inner aspect. A full rebuild avoided the problem. 

java.lang.ClassCastException: org.aspectj.weaver.MissingResolvedTypeWithKnownSignature
	at org.aspectj.ajdt.internal.core.builder.AjState.recordClassFile(AjState.java:774)
	at org.aspectj.ajdt.internal.core.builder.AjState.noteResult(AjState.java:627)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager$3.acceptResult(AjBuildManager.java:867)
	at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterProcessing(AjCompilerAdapter.java:206)
	at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$4$6b855184(CompilerAdapter.aj:90)
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:528)
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:845)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:266)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:168)
	at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
	at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)
Comment 1 Larry Edelstein CLA 2006-04-17 17:57:39 EDT
I got a similar exception (ClassCastException thrown in recordClassFile) when using a perthis(..) aspect.  A full rebuild fixed it.

However this aspect, even after it builds, is causing me problems with Spring.  Basically, I'm using Spring AOP to decorate the object with transaction semantics, and also using a plain-old compile-time aspect (this one), and I think they are interacting poorly.  I don't know if perthis() is part of the problem.  I'll probably open up another bug if it comes up.

(In reply to comment #0)
> I got this exception while working on a static inner aspect. A full rebuild
> avoided the problem. 
> 
> java.lang.ClassCastException:
> org.aspectj.weaver.MissingResolvedTypeWithKnownSignature
>         at
> org.aspectj.ajdt.internal.core.builder.AjState.recordClassFile(AjState.java:774)
>         at
> org.aspectj.ajdt.internal.core.builder.AjState.noteResult(AjState.java:627)
>         at
> org.aspectj.ajdt.internal.core.builder.AjBuildManager$3.acceptResult(AjBuildManager.java:867)
>         at
> org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterProcessing(AjCompilerAdapter.java:206)
>         at
> org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$4$6b855184(CompilerAdapter.aj:90)
>         at
> org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:528)
>         at
> org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329)
>         at
> org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:845)
>         at
> org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:266)
>         at
> org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:168)
>         at
> org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
>         at
> org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)
> 

Comment 2 Helen Beeken CLA 2006-04-26 09:09:00 EDT
Created attachment 39519 [details]
patch containing failing testcase

Whilst trying to recreate another bug I stumbled into this one. The attached patch should be applied to the tests project and contains a failing testcase.
Comment 3 Andrew Clement CLA 2006-04-26 11:35:40 EDT
nice little testcase ;)  initially looks like just an unnecessary cast...
Comment 4 Andrew Clement CLA 2006-04-26 11:39:04 EDT
interesting that the 'missing type' is actually one generated during weaving:

A$ajcMightHaveAspect

in Helens case (caused by the PerThis).  
Comment 5 Helen Beeken CLA 2006-04-27 04:39:24 EDT
Created attachment 39642 [details]
patch containing proposed fix

Apply the attached patch to the org.aspectj.ajdt.core project.

From discussions with Andy......the fix involves removing the unnecessary cast along with putting the A$ajcMightHaveAspect into the tMap within the world. It was placed in the typeXtoBinding map in the EclipseFactory but wasn't recorded in the world (Note that the first time through on the full build the A$ajcMightHaveAspect isn't generated because of the "abstract" keyword. When "abstract" is removed we generate this class.) This fix means that in all the tests the check "!newResolvedType.isMissing()" (AjState.java:784) returns true.
Comment 6 Andrew Clement CLA 2006-05-05 05:49:08 EDT
test and fix committed.