Project: AspectJ
Bug 83565 BCException "bad type name" thrown when compiling
Reported: 2005-01-24 17:13:15 | Status: resolved fixed

I just downloaded AJDT version 1.2.0.20050124144759 and I am running Eclipse 3.1M4. I tried to use aspectJ on an existing Java 5 project. There are no aspects in it yet, just straight Java 5. The project runs just fine as a standard Java project. When add the AspectJ nature and I try to compile the project, no class files are generated and I get this error generated on a type that is parameterized: Internal compiler error org.aspectj.weaver.BCException: Bad type name: at org.aspectj.weaver.TypeX.nameToSignature(TypeX.java:634) at org.aspectj.weaver.TypeX.forName(TypeX.java:87) at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.fromBinding(EclipseFactory.java:155) at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.fromBindings(EclipseFactory.java:163) at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.makeResolvedMember(EclipseFactory.java:229) at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.makeResolvedMember(EclipseFactory.java:224) at org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.visit(AsmHierarchyBuilder.java:675) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.traverse(ConstructorDeclaration.java:447) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1133) at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:314) at org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.internalBuild(AsmHierarchyBuilder.java:171) at org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.buildStructureForCompilationUnit(AsmHierarchyBuilder.java:111) at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.finishedCompilationUnit(EclipseFactory.java:354) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterProcessing(AjCompilerAdapter.java:138) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:373) 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) The source code of the file that generates this error is: package mj.compiler.ast; import java.util.Vector; import mj.compiler.Driver; import mj.compiler.Visitor; public class Sequence<T extends AST> extends AST { private Vector<T> elements = new Vector<T>(); public Sequence() { super(0, 0); } public Sequence(T element) { super(element); elements.add(element); } public int length() { return elements.size(); } public T elementAt(int i) { return elements.elementAt(i); } public Sequence add(T element) { elements.add(element); return this; } public Sequence add(int pos, T element) { elements.add(pos, element); return this; } public Sequence addAll(Sequence<T> others) { if( others == null ) return this; elements.addAll(others.elements); return this; } public void visitChildren(Visitor v) { for( AST element : elements ) { element.visit(v); } } public void replaceChild(AST old, AST gnu) { T NEW = (T)gnu; for(int i = 0; i < elements.size(); i++ ) { if( elements.get(i) == old ) { elements.set(i, NEW); return; } } throw new Driver.CompileError("Can't find child in replaceChild."); } /*** START GENERATED VISITOR PROTOCOL ***///TODO public void visit(mj.compiler.Visitor v) { v.visitSequence(this); } /*** END GENERATED VISITOR PROTOCOL ***/ } Hope this helps something. ps- I am able to create and run a very simple AspectJ project with an aspect, advice, and some Java 5 syntax.

Files changed in fix:
ajde/testdata/bug-83565/Bug.java ajde/testsrc/org/aspectj/ajde/AjdeTests.java ajde/testsrc/org/aspectj/ajde/GenericsTest.java org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java