code: static int checkDesc(final String desc, final int start,
              final boolean canBeVoid) {
          if (desc == null || start >= desc.length()) {
              throw new IllegalArgumentException(
                      "Invalid type descriptor (must not be null or empty)");
          }
          int index;
          switch (desc.charAt(start)) {
          case 'V':
              if (canBeVoid) {
                  return start + 1;
              } else {
                  throw new IllegalArgumentException("Invalid descriptor: "
                          + desc);
              }
          case 'Z':
          case 'C':
          case 'B':
          case 'S':
          case 'I':
          case 'F':
          case 'J':
          case 'D':
              return start + 1;
          case '[':
              index = start + 1;
              while (index < desc.length() && desc.charAt(index) == '[') {
                  ++index;
              }
              if (index < desc.length()) {
                  return checkDesc(desc, index, false);
              } else {
                  throw new IllegalArgumentException("Invalid descriptor: "
                          + desc);
              }
          case 'L':
              index = desc.indexOf(';', start);
              if (index == -1 || index - start < 2) {
                  throw new IllegalArgumentException("Invalid descriptor: "
                          + desc);
              }
              try {
                  checkInternalName(desc, start + 1, index, null);
              } catch (IllegalArgumentException unused) {
                  throw new IllegalArgumentException("Invalid descriptor: "
                          + desc);
              }
              return index + 1;
          default:
              throw new IllegalArgumentException("Invalid descriptor: " + desc);
          }
      }
docs: Checks that a the given substring is a valid type descriptor.
  
  @param desc
  the string to be checked.
  @param start
  index of the first character of the identifier (inclusive).
  @param canBeVoid
  <tt>true</tt> if <tt>V</tt> can be considered valid.
  @return the index of the last character of the type decriptor, plus one.