diff options
author | acolyer <acolyer> | 2005-08-24 19:20:56 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-08-24 19:20:56 +0000 |
commit | 803616d373f1c366e133f87342b88514cc5f74c3 (patch) | |
tree | 43b3947fd8c10b79781ffcaf88b6fbe387af1435 /bcel-builder | |
parent | cc6e6812fa6908d315e2f07195bca3914438cb1a (diff) | |
download | aspectj-803616d373f1c366e133f87342b88514cc5f74c3.tar.gz aspectj-803616d373f1c366e133f87342b88514cc5f74c3.zip |
fix for pr107784, failure to parse an array of a primitive type when used as a type variable
Diffstat (limited to 'bcel-builder')
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java | 8 | ||||
-rw-r--r-- | bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParserTest.java | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java index 9c7ef4e81..fac5f506b 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java @@ -306,6 +306,7 @@ public class GenericSignatureParser { List tokens = new ArrayList(); StringBuffer identifier = new StringBuffer(); boolean inParens = false; + boolean inArray = false; boolean couldSeePrimitive = false; do { switch (chars[index]) { @@ -335,6 +336,7 @@ public class GenericSignatureParser { identifier = new StringBuffer(); tokens.add(";"); couldSeePrimitive = true; + inArray = false; break; case '^': if (identifier.length() > 0) tokens.add(identifier.toString()); @@ -366,6 +368,8 @@ public class GenericSignatureParser { break; case '[' : tokens.add("["); + couldSeePrimitive = true; + inArray = true; break; case 'B' : case 'C' : @@ -376,11 +380,13 @@ public class GenericSignatureParser { case 'S' : case 'V' : case 'Z' : - if (inParens && couldSeePrimitive && identifier.length() == 0) { + if ((inParens || inArray) && couldSeePrimitive && identifier.length() == 0) { tokens.add(new String("" + chars[index])); } else { identifier.append(chars[index]); } + couldSeePrimitive = false; + inArray = false; break; default : identifier.append(chars[index]); diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParserTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParserTest.java index 12a9f1ff1..bac45e316 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParserTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParserTest.java @@ -234,6 +234,12 @@ public class GenericSignatureParserTest extends TestCase { } } + public void testPr107784() { + parser.parseAsMethodSignature( + "(Lcom/cibc/responders/mapping/CommonDataBeanScenario;Ljava/lang/Object;)Lcom/cibc/responders/response/Formatter<[BLjava/lang/Object;>;"); + parser.parseAsClassSignature("<Parent:Ljava/lang/Object;Child:Ljava/lang/Object;>Ljava/lang/Object;"); + } + private void assertEquals(String[] expected, String[] actual) { if (actual.length != expected.length) { int shorter = Math.min(expected.length,actual.length); |