public static void checkMethodTypeSig(String typesig)
			throws IllegalArgumentException {
		try {
			if (typesig.charAt(0) != '(')
				throw new IllegalArgumentException("No method signature: "
						+ typesig);
			int i = 1;
			while (typesig.charAt(i) != ')')
				i = checkTypeSig(typesig, i);
			// skip closing parenthesis.
			i++;
			if (typesig.charAt(i) == 'V')
				// accept void return type.
				i++;
			else
				i = checkTypeSig(typesig, i);
			if (i != typesig.length())
				throw new IllegalArgumentException("Type sig too long: "
						+ typesig);
		} catch (StringIndexOutOfBoundsException ex) {
			throw new IllegalArgumentException("Incomplete type sig: "
					+ typesig);
		}
	}