Bug 118792 - ClassCastException compiling the simple of aspects
Summary: ClassCastException compiling the simple of aspects
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-01 05:24 EST by Ian Orford CLA
Modified: 2006-05-10 10:45 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Orford CLA 2005-12-01 05:24:26 EST
Eclipse AspectJ Development Tools

Version: 1.3.0
Build id: 20051130095036
AspectJ version: 1.5.0.20051130133549



Trying a very simple aspect just to try to isolate another problem...

Class----------------------------
package blah;

import java.util.Random;

public class MyClass {
	public Integer getRandomInt()
	{
		return new Integer(new Random().nextInt());
	}
}
---------------------------------

Aspect---------------------------
package blah;

public aspect MyAspect {

	pointcut callPointCut(): call(public * blah.MyClass+.*(..));
	
	Object around() : callPointCut() {
		System.out.println("start of around");
		Object result = proceed();
		System.out.println("end of around");
		return result;
	}
}
------------------------------

Gives the following.


java.lang.ClassCastException
at org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType(BcelWorld.java:486)
at org.aspectj.weaver.bcel.BcelWeaver.getClassType(BcelWeaver.java:1283)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1010)
at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:300)
at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:178)
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:367)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:811)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:254)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:163)
at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

ClassCastException thrown: null
Comment 1 Andrew Clement CLA 2005-12-01 05:52:05 EST
Hmmm ... those compile fine for me.  Does it happen when you do a full build or only when you do an incremental build of the project containing these files? (An incremental build occurs when you change a file slightly and press Ctrl+S to save, whilst a full build occurs when you press the AJ build button on the toolbar).
Comment 2 Ian Orford CLA 2005-12-01 06:07:10 EST
Incremental only.
In fact, now I've done a proper build, even incremental builds are working.

It may still be a bug, but I'm sorted.
Comment 3 Wes Isberg CLA 2006-05-10 10:45:07 EDT
Presumed fixed as unable-to-reproduce.  Please reopen if reproduced.
stalebug