]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for pr112458 - also created the 151 test areas and driving junit infrast...
authoraclement <aclement>
Tue, 10 Jan 2006 09:44:47 +0000 (09:44 +0000)
committeraclement <aclement>
Tue, 10 Jan 2006 09:44:47 +0000 (09:44 +0000)
tests/bugs151/pr112458.aj [new file with mode: 0644]
tests/bugs151/pr112458_2.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/AllTests15.java
tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml [new file with mode: 0644]
weaver/src/org/aspectj/weaver/TypeFactory.java

diff --git a/tests/bugs151/pr112458.aj b/tests/bugs151/pr112458.aj
new file mode 100644 (file)
index 0000000..d99f09c
--- /dev/null
@@ -0,0 +1,6 @@
+public class pr112458<V>
+{
+    public void setInnerClasses(InnerClass[] classes){};
+
+    public static class InnerClass {}
+}
diff --git a/tests/bugs151/pr112458_2.aj b/tests/bugs151/pr112458_2.aj
new file mode 100644 (file)
index 0000000..f17abfe
--- /dev/null
@@ -0,0 +1,15 @@
+public class pr112458_2<V>
+{
+    public void setInnerClasses(InnerClass[] classes){};
+
+    public static class InnerClass {}
+
+   public static void main(String []argv) {
+     new pr112458_2();
+   }
+}
+
+aspect X {
+  before(pr112458_2.InnerClass[] ics): execution(void setInnerClasses(..)) && args(ics) {
+  }
+}
index 6390e42a9a23685355ade2c70b4055f173db7deb..fec8757855dca1d24e79d1dd251c65497905ddaf 100644 (file)
@@ -8,6 +8,7 @@ import junit.framework.TestSuite;
 
 import org.aspectj.systemtest.ajc150.AllTestsAspectJ150;
 import org.aspectj.systemtest.ajc150.ataspectj.AtAjAnnotationGenTests;
+import org.aspectj.systemtest.ajc151.AllTestsAspectJ151;
 
 public class AllTests15 {
 
@@ -16,6 +17,7 @@ public class AllTests15 {
                //$JUnit-BEGIN$
                suite.addTest(AllTests14.suite());
                suite.addTest(AllTestsAspectJ150.suite());
+               suite.addTest(AllTestsAspectJ151.suite());
                suite.addTest(AtAjAnnotationGenTests.suite());
                //$JUnit-END$
                return suite;
index 32748c45590aba89094ea4b759b80f44e7265d5f..11bfca8886cb365da9d2d60c6756707830a908fa 100644 (file)
@@ -24,7 +24,7 @@ import junit.framework.TestSuite;
 public class AllTestsAspectJ150 {
 
        public static Test suite() {
-               TestSuite suite = new TestSuite("Java5/AspectJ5 tests");
+               TestSuite suite = new TestSuite("AspectJ1.5.0 tests");
                //$JUnit-BEGIN$
                suite.addTestSuite(MigrationTests.class);
                suite.addTest(Ajc150Tests.suite());
diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
new file mode 100644 (file)
index 0000000..fb6dfea
--- /dev/null
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc151;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+         
+  public void testMemberTypesInGenericTypes_pr112458()    { runTest("member types in generic types");}
+  public void testMemberTypesInGenericTypes_pr112458_2()  { runTest("member types in generic types - 2");}
+  
+  
+  /////////////////////////////////////////
+  public static Test suite() {
+    return XMLBasedAjcTestCase.loadSuite(Ajc151Tests.class);
+  }
+
+  protected File getSpecFile() {
+    return new File("../tests/src/org/aspectj/systemtest/ajc151/ajc151.xml");
+  }
+  
+}
\ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java b/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java
new file mode 100644 (file)
index 0000000..31d37c5
--- /dev/null
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc151;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsAspectJ151 {
+
+       public static Test suite() {
+               TestSuite suite = new TestSuite("AspectJ 1.5.1 tests");
+               //$JUnit-BEGIN$
+               suite.addTest(Ajc151Tests.suite());
+        //$JUnit-END$
+               return suite;
+       }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
new file mode 100644 (file)
index 0000000..ac841e1
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<!-- AspectJ v1.5.1 Tests -->
+<suite>
+    
+    <ajc-test dir="bugs151" title="member types in generic types">
+        <compile files="pr112458.aj" options="-1.5 -emacssym"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs151" title="member types in generic types - 2">
+        <compile files="pr112458_2.aj" options="-1.5 -emacssym"/>
+        <run class="pr112458_2"/>
+    </ajc-test>
+
+</suite>
\ No newline at end of file
index c90672bd3782674bd1c5a0bfc598f2dd6a4e3db2..9ca5d7ba92d1351720ad6805b505bd194c56003e 100644 (file)
@@ -81,11 +81,23 @@ public class TypeFactory {
                
                if (signature.startsWith(ResolvedType.PARAMETERIZED_TYPE_IDENTIFIER)) {
                        // parameterized type, calculate signature erasure and type parameters
+                       
+                       // (see pr112458) It is possible for a parameterized type to have *no* type parameters visible in its signature.
+                       // This happens for an inner type of a parameterized type which simply inherits the type parameters
+                       // of its parent.  In this case it is parameterized but theres no < in the signature.
+                       
                        int startOfParams = signature.indexOf('<');
                        int endOfParams = signature.lastIndexOf('>');
-                       String signatureErasure = "L" + signature.substring(1,startOfParams) + ";";
-                       UnresolvedType[] typeParams = createTypeParams(signature.substring(startOfParams +1, endOfParams));
-                       return new UnresolvedType(signature,signatureErasure,typeParams);
+                       if (startOfParams==-1) {
+                               // Should be an inner type of a parameterized type - could assert there is a '$' in the signature....
+                               String signatureErasure = "L" + signature.substring(1);
+                               UnresolvedType[] typeParams = new UnresolvedType[0];
+                               return new UnresolvedType(signature,signatureErasure,typeParams);
+                       } else {
+                               String signatureErasure = "L" + signature.substring(1,startOfParams) + ";";
+                               UnresolvedType[] typeParams = createTypeParams(signature.substring(startOfParams +1, endOfParams));
+                               return new UnresolvedType(signature,signatureErasure,typeParams);
+                       }
                } else if (signature.equals("?")){
                        UnresolvedType ret = UnresolvedType.SOMETHING;
                        ret.typeKind = TypeKind.WILDCARD;