private static Member memberForSignature2(String s, boolean isCtor) {
        int openPar = s.indexOf('(');
        int closePar = s.indexOf(')');
        // Verify only one open/close paren, and close paren is last char.
        assert openPar == s.lastIndexOf('(') : s;
        assert closePar == s.lastIndexOf(')') : s;
        assert closePar == s.length() - 1 : s;
        String clsAndMethod = s.substring(0, openPar);
        int lastDot = clsAndMethod.lastIndexOf('.');
        // There should be at least one dot, separating class/method name.
        assert lastDot >= 0;
        String clsName = clsAndMethod.substring(0, lastDot);
        String methodName = clsAndMethod.substring(lastDot + 1);
        if (isCtor)
            assert methodName.equals("<init>");
        String argsOneStr = s.substring(openPar + 1, closePar);

        // Extract parameter types.
        Class<?>[] argTypes = new Class<?>[0];
        if (argsOneStr.trim().length() > 0) {
            String[] argsStrs = argsOneStr.split(",");
            argTypes = new Class<?>[argsStrs.length];
            for (int i = 0; i < argsStrs.length; i++) {
                argTypes[i] = classForName(argsStrs[i].trim());
            }
        }

        Class<?> cls = classForName(clsName);
        try {
            if (isCtor)
                return cls.getDeclaredConstructor(argTypes);
            else
                return cls.getDeclaredMethod(methodName, argTypes);
        }
        catch (Exception e) {
            throw new Error(e);
        }
    }