diff options
author | aclement <aclement> | 2005-06-01 14:57:23 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-06-01 14:57:23 +0000 |
commit | 5027659c5ff147f0a342379f3c059404f6f3a800 (patch) | |
tree | baaef6457b3277a3ed7e723197c595b569cd6b22 | |
parent | d21465f01441f77a6998f3470092316b15c35761 (diff) | |
download | aspectj-5027659c5ff147f0a342379f3c059404f6f3a800.tar.gz aspectj-5027659c5ff147f0a342379f3c059404f6f3a800.zip |
GenericsWork: Angly aware signature processing.
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java index fa069da4d..dee474795 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java @@ -65,7 +65,7 @@ import org.aspectj.apache.bcel.classfile.Utility; * Abstract super class for all possible java types, namely basic types * such as int, object types like String and array types, e.g. int[] * - * @version $Id: Type.java,v 1.4 2005/03/10 12:14:19 aclement Exp $ + * @version $Id: Type.java,v 1.5 2005/06/01 14:57:23 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * * modified: @@ -175,9 +175,31 @@ public abstract class Type implements java.io.Serializable { return new TypeHolder(new ArrayType(th.getType(), dim),dim+th.getConsumed()); } else { // type == T_REFERENCE // Format is 'Lblahblah;' - int index = signature.indexOf(';'); // Look for closing `;' - if(index < 0) throw new ClassFormatException("Invalid signature: " + signature); - return new TypeHolder(new ObjectType(signature.substring(1, index).replace('/', '.')),index+1); + int index = signature.indexOf(';'); // Look for closing ';' + if (index < 0) throw new ClassFormatException("Invalid signature: " + signature); + + // generics awareness + int nextAngly = signature.indexOf('<'); + String typeString = null; + if (nextAngly==-1 || nextAngly>index) { + typeString = signature.substring(1,index).replace('/','.'); + } else { + boolean endOfSigReached = false; + int posn = nextAngly; + int genericDepth=0; + while (!endOfSigReached) { + switch (signature.charAt(posn++)) { + case '<': genericDepth++;break; + case '>': genericDepth--;break; + case ';': if (genericDepth==0) endOfSigReached=true;break; + default: + } + } + index=posn-1; + typeString = signature.substring(1,nextAngly).replace('/','.'); + } + // ObjectType doesn't currently store parameterized info + return new TypeHolder(new ObjectType(typeString),index+1); } } |