]> source.dussan.org Git - aspectj.git/commitdiff
fix for Bugzilla Bug 84333
authoracolyer <acolyer>
Wed, 23 Mar 2005 20:26:21 +0000 (20:26 +0000)
committeracolyer <acolyer>
Wed, 23 Mar 2005 20:26:21 +0000 (20:26 +0000)
   BCException: Bad type name: TypeX.nameToSignature(TypeX.java:635)

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
tests/java5/generics/ITDReturningParameterizedType.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

index 3d82006add6ecdae646cabab0ccb84340d0fcad9..5aeedd62e40026349cc446698b38f6260976b051 100644 (file)
@@ -51,6 +51,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
  
 /**
  * @author Jim Hugunin
@@ -158,6 +159,12 @@ public class EclipseFactory {
                if (binding == null || binding.qualifiedSourceName() == null) {
                        return ResolvedTypeX.MISSING;
                }
+               // first piece of generics support!
+               if (binding instanceof TypeVariableBinding) {
+                       // this is a type variable...
+                       TypeVariableBinding tvb = (TypeVariableBinding) binding;
+                       return TypeX.forName(getName(tvb.firstBound)); // XXX needs more investigation as to whether this is correct in all cases
+               }
                return TypeX.forName(getName(binding));
        }
 
diff --git a/tests/java5/generics/ITDReturningParameterizedType.aj b/tests/java5/generics/ITDReturningParameterizedType.aj
new file mode 100644 (file)
index 0000000..aa5f3e9
--- /dev/null
@@ -0,0 +1,21 @@
+import java.util.*;
+
+public aspect ITDReturningParameterizedType {
+       
+       private List<String> C.strings = new ArrayList<String>();
+       
+       public List<String> C.getStrings() {
+               return strings;
+       }
+       
+       
+       public static void main(String[] args) {
+               C c = new C();
+               List<String> ss = c.getStrings();
+       }
+}
+
+
+class C {
+       
+}
\ No newline at end of file
index 0d3b6b076f670b864884f78ca1e8123670b0cedd..0af01c1b7e4b7ef22010737156599918630ed712 100644 (file)
@@ -149,6 +149,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("dirs on aspectpath");
   }
   
+  public void testIntroSample() {
+         runTest("introduction sample");
+  }
+  
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
new file mode 100644 (file)
index 0000000..332f0dd
--- /dev/null
@@ -0,0 +1,22 @@
+package org.aspectj.systemtest.ajc150;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+public class GenericsTests extends XMLBasedAjcTestCase {
+
+       public static Test suite() {
+               return XMLBasedAjcTestCase.loadSuite(GenericsTests.class);
+       }
+
+       protected File getSpecFile() {
+               return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+       }
+       
+       public void testITDReturningParameterizedType() {
+               runTest("ITD with parameterized type");
+       }
+}
index e92516e8503d4836ae5d9f3c4a9153d4527e5920..c80d5f6818acd231d3ec967c5f11f74c2863875a 100644 (file)
     <ajc-test dir="bugs150" title="bad asm for enums" vm="1.5">
         <compile files="Rainbow.java" options="-emacssym,-1.5"/>
     </ajc-test>
+    
+    <ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5">
+        <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5"/>
+    </ajc-test>
 
     <ajc-test dir="java5/varargs" title="varargs in constructor sig" vm="1.5">
         <compile files="Pr88652.aj" options="-1.5">
         </compile>
     </ajc-test>
 
+    <!-- Generics tests -->
+
+    <ajc-test dir="java5/generics" title="ITD with parameterized type" vm="1.5">
+        <compile files="ITDReturningParameterizedType.aj" options="-1.5"/>
+        <run class="ITDReturningParameterizedType"/>
+    </ajc-test>
 </suite>
\ No newline at end of file