summaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authoraclement <aclement>2005-06-01 14:57:23 +0000
committeraclement <aclement>2005-06-01 14:57:23 +0000
commit5027659c5ff147f0a342379f3c059404f6f3a800 (patch)
treebaaef6457b3277a3ed7e723197c595b569cd6b22 /bcel-builder
parentd21465f01441f77a6998f3470092316b15c35761 (diff)
downloadaspectj-5027659c5ff147f0a342379f3c059404f6f3a800.tar.gz
aspectj-5027659c5ff147f0a342379f3c059404f6f3a800.zip
GenericsWork: Angly aware signature processing.
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java30
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);
}
}