]> source.dussan.org Git - aspectj.git/commitdiff
237447: test and fix: nested parameterization
authoraclement <aclement>
Wed, 18 Jun 2008 17:18:51 +0000 (17:18 +0000)
committeraclement <aclement>
Wed, 18 Jun 2008 17:18:51 +0000 (17:18 +0000)
weaver/src/org/aspectj/weaver/TypeFactory.java

index b314d4001666d27a670c1c0902bfe402ae05f0e2..aeea50c90f9e9d6f184dd0636851dd29d5d3d924 100644 (file)
@@ -14,6 +14,8 @@ package org.aspectj.weaver;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.aspectj.asm.internal.CharOperation;
+
 /**
  * @author colyer
  *
@@ -245,4 +247,27 @@ public class TypeFactory {
                types.toArray(typeParams);
                return typeParams;
        }
+
+       // OPTIMIZE improve all this signature processing stuff, use char arrays, etc
+       
+       /**
+        * Create a signature then delegate to the other factory method.  Same input/output:
+        * baseTypeSignature="LSomeType;"
+        * arguments[0]= something with sig "Pcom/Foo<Ljava/lang/String;>;"
+        * signature created = "PSomeType<Pcom/Foo<Ljava/lang/String;>;>;"
+        */
+       public static UnresolvedType createUnresolvedParameterizedType(String baseTypeSignature, UnresolvedType[] arguments) {
+               StringBuffer parameterizedSig = new StringBuffer();
+               parameterizedSig.append(ResolvedType.PARAMETERIZED_TYPE_IDENTIFIER);
+               parameterizedSig.append(baseTypeSignature.substring(1,baseTypeSignature.length()-1));
+               if (arguments.length > 0) {
+                       parameterizedSig.append("<");
+                       for (int i=0;i<arguments.length;i++) {
+                               parameterizedSig.append(arguments[i].getSignature());
+                       }
+                       parameterizedSig.append(">");
+               }
+               parameterizedSig.append(";");
+               return createUnresolvedParameterizedType(parameterizedSig.toString(),baseTypeSignature,arguments);
+       }
 }