code: public static Method getMethod(final String method,
              final boolean defaultPackage) throws IllegalArgumentException {
          int space = method.indexOf(' ');
          int start = method.indexOf('(', space) + 1;
          int end = method.indexOf(')', start);
          if (space == -1 || start == -1 || end == -1) {
              throw new IllegalArgumentException();
          }
          String returnType = method.substring(0, space);
          String methodName = method.substring(space + 1, start - 1).trim();
          StringBuilder sb = new StringBuilder();
          sb.append('(');
          int p;
          do {
              String s;
              p = method.indexOf(',', start);
              if (p == -1) {
                  s = map(method.substring(start, end).trim(), defaultPackage);
              } else {
                  s = map(method.substring(start, p).trim(), defaultPackage);
                  start = p + 1;
              }
              sb.append(s);
          } while (p != -1);
          sb.append(')');
          sb.append(map(returnType, defaultPackage));
          return new Method(methodName, sb.toString());
      }
docs: Returns a {@link Method} corresponding to the given Java method
  declaration.
  
  @param method
  a Java method declaration, without argument names, of the form
  "returnType name (argumentType1, ... argumentTypeN)", where
  the types are in plain Java (e.g. "int", "float",
  "java.util.List", ...). Classes of the java.lang package may
  be specified by their unqualified name, depending on the
  defaultPackage argument; all other classes names must be fully
  qualified.
  @param defaultPackage
  true if unqualified class names belong to the default package,
  or false if they correspond to java.lang classes. For instance
  "Object" means "Object" if this option is true, or
  "java.lang.Object" otherwise.
  @return a {@link Method} corresponding to the given Java method
  declaration.
  @throws IllegalArgumentException
  if <code>method</code> could not get parsed.