summaryrefslogtreecommitdiffstats
path: root/bcel-builder/src
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-08-24 13:55:38 +0000
committeracolyer <acolyer>2005-08-24 13:55:38 +0000
commit5ae8fd75d09b1f4f4d178e1371a96756ff3edd8b (patch)
treed9c60ddb6874ee8395b0042300b99e7cffb7e207 /bcel-builder/src
parent76a76ff7936851f0a1eaf99985f38df8b6b6f5be (diff)
downloadaspectj-5ae8fd75d09b1f4f4d178e1371a96756ff3edd8b.tar.gz
aspectj-5ae8fd75d09b1f4f4d178e1371a96756ff3edd8b.zip
better error messages when failing to unpack a generic signature
Diffstat (limited to 'bcel-builder/src')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java12
1 files changed, 8 insertions, 4 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 0160278d3..9c7ef4e81 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/GenericSignatureParser.java
@@ -30,6 +30,7 @@ import org.aspectj.apache.bcel.classfile.Signature.BaseTypeSignature;
*/
public class GenericSignatureParser {
+ private String inputString;
private String[] tokenStream; // for parse in flight
private int tokenIndex = 0;
@@ -39,6 +40,7 @@ public class GenericSignatureParser {
* the grammar defined in Section 4.4.4 of the JVM specification.
*/
public Signature.ClassSignature parseAsClassSignature(String sig) {
+ this.inputString = sig;
tokenStream = tokenize(sig);
tokenIndex = 0;
Signature.ClassSignature classSig = new Signature.ClassSignature();
@@ -67,6 +69,7 @@ public class GenericSignatureParser {
* the grammar defined in Section 4.4.4 of the JVM specification.
*/
public MethodTypeSignature parseAsMethodSignature(String sig) {
+ this.inputString = sig;
tokenStream = tokenize(sig);
tokenIndex = 0;
FormalTypeParameter[] formals = new FormalTypeParameter[0];
@@ -115,6 +118,7 @@ public class GenericSignatureParser {
* the grammar defined in Section 4.4.4 of the JVM specification.
*/
public FieldTypeSignature parseAsFieldSignature(String sig) {
+ this.inputString = sig;
tokenStream = tokenize(sig);
tokenIndex = 0;
return parseFieldTypeSignature(false);
@@ -156,8 +160,8 @@ public class GenericSignatureParser {
} else if (tokenStream[tokenIndex].startsWith("T")) {
return parseTypeVariableSignature();
} else {
- throw new IllegalStateException("Expection [,L, or T, but found " +
- tokenStream[tokenIndex]);
+ throw new IllegalStateException("Expecting [,L, or T, but found " +
+ tokenStream[tokenIndex] + " while unpacking " + inputString);
}
}
@@ -218,7 +222,7 @@ public class GenericSignatureParser {
nestedTypes = new SimpleClassTypeSignature[nestedTypeList.size()];
nestedTypeList.toArray(nestedTypes);
} else {
- throw new IllegalStateException("Expecting .,<, or ;, but found " + tokenStream[tokenIndex]);
+ throw new IllegalStateException("Expecting .,<, or ;, but found " + tokenStream[tokenIndex] + " while unpacking " + inputString);
}
}
ret.append(";");
@@ -282,7 +286,7 @@ public class GenericSignatureParser {
private void eat(String token) {
if (!tokenStream[tokenIndex].equals(token)) {
- throw new IllegalStateException("Expecting " + token + " but found " + tokenStream[tokenIndex]);
+ throw new IllegalStateException("Expecting " + token + " but found " + tokenStream[tokenIndex] + " while unpacking " + inputString);
}
tokenIndex++;
}