Пример #1
0
    /**
     * Parses '<T1,T2,...,Tn>'
     *
     * @return the index of the character next to '>'
     */
    private JClass parseArguments(JClass rawType) throws ClassNotFoundException {
      if (s.charAt(idx) != '<') throw new IllegalArgumentException();
      idx++;

      List<JClass> args = new ArrayList<JClass>();

      while (true) {
        args.add(parseTypeName());
        if (idx == s.length()) throw new IllegalArgumentException("Missing '>' in " + s);
        char ch = s.charAt(idx);
        if (ch == '>') return rawType.narrow(args.toArray(new JClass[args.size()]));

        if (ch != ',') throw new IllegalArgumentException(s);
        idx++;
      }
    }