in asm-util/src/main/java/org/objectweb/asm/util/CheckMethodAdapter.java [1365:1410]
private static int checkDescriptor(
final int version, final String descriptor, final int startPos, final boolean canBeVoid) {
if (descriptor == null || startPos >= descriptor.length()) {
throw new IllegalArgumentException("Invalid type descriptor (must not be null or empty)");
}
switch (descriptor.charAt(startPos)) {
case 'V':
if (canBeVoid) {
return startPos + 1;
} else {
throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
}
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
case 'F':
case 'J':
case 'D':
return startPos + 1;
case '[':
int pos = startPos + 1;
while (pos < descriptor.length() && descriptor.charAt(pos) == '[') {
++pos;
}
if (pos < descriptor.length()) {
return checkDescriptor(version, descriptor, pos, false);
} else {
throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
}
case 'L':
int endPos = descriptor.indexOf(';', startPos);
if (startPos == -1 || endPos - startPos < 2) {
throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
}
try {
checkInternalClassName(version, descriptor.substring(startPos + 1, endPos), null);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor, e);
}
return endPos + 1;
default:
throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
}
}