From 0385109ac1940c15e4bff9797d835d71866dee30 Mon Sep 17 00:00:00 2001 From: acolyer Date: Fri, 8 Jul 2005 10:22:52 +0000 Subject: [PATCH] can create a parameterized type from an array of TypeX's --- weaver/src/org/aspectj/weaver/TypeX.java | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/TypeX.java b/weaver/src/org/aspectj/weaver/TypeX.java index eb04001b6..630b24fad 100644 --- a/weaver/src/org/aspectj/weaver/TypeX.java +++ b/weaver/src/org/aspectj/weaver/TypeX.java @@ -243,15 +243,20 @@ public class TypeX implements AnnotatedElement { * and parameterized type names. */ public static TypeX forParameterizedTypeNames(String name, String[] paramTypeNames) { - TypeX ret = TypeX.forName(name); - ret.typeKind=PARAMETERIZED; - ret.typeParameters = null; - if (paramTypeNames!=null) { - ret.typeParameters = new TypeX[paramTypeNames.length]; + TypeX[] paramTypes = null; + if (paramTypeNames!=null) { + paramTypes = new TypeX[paramTypeNames.length]; for (int i = 0; i < paramTypeNames.length; i++) { - ret.typeParameters[i] = TypeX.forName(paramTypeNames[i]); + paramTypes[i] = TypeX.forName(paramTypeNames[i]); } } + return TypeX.forParameterizedTypes(name, paramTypes); + } + + public static TypeX forParameterizedTypes(String name, TypeX[] paramTypes) { + TypeX ret = TypeX.forName(name); + ret.typeKind=PARAMETERIZED; + ret.typeParameters = paramTypes; ret.rawTypeSignature = ret.signature; // sig for e.g. List is Ljava/util/List; if (ret.typeParameters!=null) { @@ -264,7 +269,7 @@ public class TypeX implements AnnotatedElement { sigAddition.append(";"); ret.signature = ret.signature.substring(0,ret.signature.length()-1) + sigAddition.toString(); } - return ret; + return ret; } public static TypeX forRawTypeNames(String name) { @@ -468,7 +473,8 @@ public class TypeX implements AnnotatedElement { return typeKind==RAW; } - public final boolean isGeneric() { + // AMC - made non-final since ReferenceType needs to override this. + public /*final*/ boolean isGeneric() { return typeKind==GENERIC; } -- 2.39.5