private static TypeDesc parseTypeDesc(String src, int[] pos) {
        // Skip leading whitespace.
        skipWhitespace(src, pos);
        int i = pos[0];
        int length = src.length();
        if (i >= length) {
            return null;
        }

        int startPos = i;
        char c = src.charAt(i);
        if (!Character.isJavaIdentifierStart(c)) {
            return null;
        }
        i++;

        while (i < length) {
            c = src.charAt(i);
            if (c == '.') {
                // Don't allow double dots.
                if (i + 1 < length && src.charAt(i + 1) == '.') {
                    break;
                } else {
                    i++;
                }
            } else if (Character.isJavaIdentifierPart(c) || c == '[' || c == ']') {
                i++;
            } else {
                break;
            }
        }

        pos[0] = i;

        // Skip trailing whitespace too.
        skipWhitespace(src, pos);

        return TypeDesc.forClass(src.substring(startPos, i));
    }