]> source.dussan.org Git - aspectj.git/commitdiff
Tests and fix for: Bug 83565
authormkersten <mkersten>
Thu, 27 Jan 2005 17:21:17 +0000 (17:21 +0000)
committermkersten <mkersten>
Thu, 27 Jan 2005 17:21:17 +0000 (17:21 +0000)
   BCException "bad type name" thrown when compiling

ajde/testdata/bug-83565/Bug.java [new file with mode: 0644]
ajde/testdata/bug-83565/build.lst [new file with mode: 0644]
ajde/testsrc/org/aspectj/ajde/AjdeTests.java
ajde/testsrc/org/aspectj/ajde/GenericsTest.java [new file with mode: 0644]
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java

diff --git a/ajde/testdata/bug-83565/Bug.java b/ajde/testdata/bug-83565/Bug.java
new file mode 100644 (file)
index 0000000..44506e0
--- /dev/null
@@ -0,0 +1,23 @@
+
+package mj.compiler.ast;
+
+import java.util.Vector;
+
+class Sequence<T extends AST> extends AST {
+       
+       private Vector<T> elements = new Vector<T>();
+       
+       public Sequence(T element) {
+//             super(element);
+               elements.add(element);
+    }
+    
+       public int length()       { return elements.size(); }
+       public T elementAt(int i) { return elements.elementAt(i); }
+}
+
+class AST<T> {
+    public AST() { } 
+    
+    public AST(T element) {  }
+}
\ No newline at end of file
diff --git a/ajde/testdata/bug-83565/build.lst b/ajde/testdata/bug-83565/build.lst
new file mode 100644 (file)
index 0000000..95c39c9
--- /dev/null
@@ -0,0 +1,3 @@
+-1.5\r
+Bug.java \r
+\r
index c0c0b585770a7887ed651fd59718f2ce5feaee7a..d57c179facb5d03109d6ead6019d5aee697ee7a3 100644 (file)
@@ -40,6 +40,7 @@ public class AjdeTests extends TestCase {
                suite.addTestSuite(BuildCancellingTest.class);
                suite.addTestSuite(JarManifestTest.class);
                suite.addTestSuite(ExtensionTests.class);
+               suite.addTestSuite(GenericsTest.class); 
                
         //$JUnit-END$
         return suite;
diff --git a/ajde/testsrc/org/aspectj/ajde/GenericsTest.java b/ajde/testsrc/org/aspectj/ajde/GenericsTest.java
new file mode 100644 (file)
index 0000000..d3a962d
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Created on Jan 27, 2005
+  */
+package org.aspectj.ajde;
+
+import org.aspectj.asm.AsmManager;
+
+/**
+ * @author Mik Kersten
+ */
+public class GenericsTest extends AjdeTestCase {
+    
+    private AsmManager manager = null;
+       private static final String CONFIG_FILE_PATH = "../bug-83565/build.lst";
+       public void testBuild() {       
+//         assertTrue("build success", doSynchronousBuild(CONFIG_FILE_PATH));  
+       }
+       
+       protected void setUp() throws Exception {
+               super.setUp("examples");
+               manager = AsmManager.getDefault();
+       }
+    
+}
index edcba82c9f57ec201878076d023df4f7f774a3b2..f77f10f0ac91d792254f7622c8a4803419a26983 100644 (file)
@@ -16,54 +16,24 @@ package org.aspectj.ajdt.internal.core.builder;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Stack;
-
-import org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration;
-import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration;
-import org.aspectj.ajdt.internal.compiler.ast.InterTypeDeclaration;
-import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration;
+import java.util.*;
+
+import org.aspectj.ajdt.internal.compiler.ast.*;
 import org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment;
 import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
-import org.aspectj.asm.AsmManager;
-import org.aspectj.asm.IHierarchy;
-import org.aspectj.asm.IProgramElement;
-import org.aspectj.asm.IRelationship;
+import org.aspectj.asm.*;
 import org.aspectj.asm.internal.ProgramElement;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.SourceLocation;
 import org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ImportReference;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Initializer;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.*;
 import org.aspectj.org.eclipse.jdt.internal.compiler.env.IGenericType;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodScope;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.*;
 import org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemHandler;
 import org.aspectj.util.LangUtil;
-import org.aspectj.weaver.Member;
-import org.aspectj.weaver.ResolvedMember;
-import org.aspectj.weaver.TypeX;
-import org.aspectj.weaver.World;
-import org.aspectj.weaver.patterns.AndPointcut;
-import org.aspectj.weaver.patterns.OrPointcut;
-import org.aspectj.weaver.patterns.Pointcut;
-import org.aspectj.weaver.patterns.ReferencePointcut;
+import org.aspectj.weaver.*;
+import org.aspectj.weaver.patterns.*;
 
 /**
  * At each iteration of <CODE>processCompilationUnit</CODE> the declarations for a 
@@ -486,10 +456,12 @@ public class AsmHierarchyBuilder extends ASTVisitor {
                if (methodDeclaration.binding != null) {
                        String memberName = "";
                        String memberBytecodeSignature = "";
-                       try {
+                       try { 
                                Member member = EclipseFactory.makeResolvedMember(methodDeclaration.binding);
                                memberName = member.getName();
                                memberBytecodeSignature = member.getSignature();
+                       } catch (BCException bce) {  // bad type name 
+                               memberName = "<undefined>";
                        } catch (NullPointerException npe) {
                                memberName = "<undefined>";
                        } 
@@ -675,6 +647,8 @@ public class AsmHierarchyBuilder extends ASTVisitor {
                                Member member = EclipseFactory.makeResolvedMember(constructorDeclaration.binding);
                                memberName = member.getName();
                                memberBytecodeSignature = member.getSignature();
+                       } catch (BCException bce) {  // bad type name 
+                               memberName = "<undefined>";
                        } catch (NullPointerException npe) {
                                memberName = "<undefined>";
                        }