diff options
Diffstat (limited to 'src/main/javassist/bytecode/SignatureAttribute.java')
-rw-r--r-- | src/main/javassist/bytecode/SignatureAttribute.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main/javassist/bytecode/SignatureAttribute.java b/src/main/javassist/bytecode/SignatureAttribute.java index 1a8a62dc..6a483057 100644 --- a/src/main/javassist/bytecode/SignatureAttribute.java +++ b/src/main/javassist/bytecode/SignatureAttribute.java @@ -121,29 +121,29 @@ public class SignatureAttribute extends AttributeInfo { if (j < 0) break; - StringBuilder nameBuf = new StringBuilder(); - int k = j; - char c; - try { - while ((c = desc.charAt(++k)) != ';') { - nameBuf.append(c); - if (c == '<') { - while ((c = desc.charAt(++k)) != '>') - nameBuf.append(c); - - nameBuf.append(c); - } - } + int k = desc.indexOf(';', j); + if (k < 0) + break; + + int l = desc.indexOf('<', j); + int classEndIndex; + char classEndChar; + if (l < 0 || k < l) { + classEndIndex = k; + classEndChar = ';'; + } else { + classEndIndex = l; + classEndChar = '<'; } - catch (IndexOutOfBoundsException e) { break; } - i = k + 1; - String name = nameBuf.toString(); + i = classEndIndex + 1; + + String name = desc.substring(j + 1, classEndIndex); String name2 = map.get(name); if (name2 != null) { newdesc.append(desc.substring(head, j)); newdesc.append('L'); newdesc.append(name2); - newdesc.append(c); + newdesc.append(classEndChar); head = i; } } |