Community
Participate
Working Groups
My project compiles successfully when the Java compiler property "Unnecessary cast or 'instanceof' operation" is set to ignore. After setting this property to warning, Eclipse displays an "AspectJ Error" message box with the message: ClassCastException thrown: org.aspectj.org.eclipse.jdt.internal.compiler.ast.CastExpression$1 Reason: ClassCastException thrown: org.aspectj.org.eclipse.jdt.internal.compiler.ast.CastExpression$1 Then in the Problems view, I can see the following error: Internal compiler error java.lang.ClassCastException: org.aspectj.org.eclipse.jdt.internal.compiler.ast.CastExpression$1 at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding.getVisibleBinding(MethodBinding.java:141) at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getConstructor(Scope.java:1101) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CastExpression.checkAlternateBinding(CastExpression.java:399) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CastExpression.checkNeedForArgumentCasts(CastExpression.java:317) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:274) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:189) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:385) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:137) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:363) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:933) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:982) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:273) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:544) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:365) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:682) 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.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:122) at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:165) I removed code from the class where the internal compiler error occurred while I still got the error. The remaining code looked like: public class MyClass { private GenericPosition position; private Object object; private void myMethod() { InstalledObject io = new InstalledObject((SpecificPosition) position, object); } } Where: - SpecificPosition is a class that implements the interface GenericPosition. - The constructor of InstalledObject takes a SpecificPosition as the first parameter. I tried to reproduce this issue in a new small project (my project contains more than 800 classes) without success.
Passing over to compiler
I modified our test system to force -warn:uselessTypeCheck on - it ran all 1700 tests without showing a problem. Now I *am* running on a more recent JDT compiler than the one used when this bug was reported - it could have been fixed since this report was filed. Is it possible to retry this on a more recent AJDT dev build (since that will include the new compiler) ?
we haven't been able to reproduce this with the latest builds, and we haven't seen it in the wild since May, so closing out this report. Please reopen if you see this behaviour again in the future with the latest builds.