JS_AddRoot(cx, &member_descriptor->invoke_func_obj);
JS_AddNamedRoot(cx, &member_descriptor->invoke_func_obj, "&member_descriptor->invoke_func_obj");
jsj_ResolveExplicitMethod(JSContext *cx, JNIEnv *jEnv,			  JavaClassDescriptor *class_descriptor, 			  jsid method_name_id,			  JSBool is_static){    JavaMethodSpec *method;    JavaMemberDescriptor *member_descriptor;    JavaMethodSignature *ms;    JSString *simple_name_jsstr;    JSFunction *fun;    JSBool is_constructor;    int left_paren;    const char *sig_cstr, *method_name;    char *arg_start;    jsid id;    jsval method_name_jsval;          /*     * Get the simple name of the explicit method, i.e. get "cos" from     * "cos(double)", and use it to create a new JS string.     */    JS_IdToValue(cx, method_name_id, &method_name_jsval);    method_name = JS_GetStringBytes(JSVAL_TO_STRING(method_name_jsval));    arg_start = strchr(method_name, '(');	/* Skip until '(' */    /* If no left-paren, then this is not a case of explicit method resolution */    if (!arg_start)	return NULL;    /* Left-paren must be first character for constructors */    is_constructor = (is_static && (arg_start == method_name));            left_paren = arg_start - method_name;    simple_name_jsstr = JS_NewStringCopyN(cx, method_name, left_paren);    if (!simple_name_jsstr)	return NULL;    /* Find all the methods in the same class with the same simple name */    JS_ValueToId(cx, STRING_TO_JSVAL(simple_name_jsstr), &id);    if (is_constructor)        member_descriptor = jsj_LookupJavaClassConstructors(cx, jEnv, class_descriptor);    else if (is_static)	member_descriptor = jsj_LookupJavaStaticMemberDescriptorById(cx, jEnv, class_descriptor, id);    else	member_descriptor = jsj_LookupJavaMemberDescriptorById(cx, jEnv, class_descriptor, id);    if (!member_descriptor)	/* No member with matching simple name ? */	return NULL;        /*     * Do a UTF8 comparison of method signatures with all methods of the same name,     * so as to discover a method which exactly matches the specified argument types.     */    if (!strlen(arg_start + 1))	return NULL;    arg_start = JS_strdup(cx, arg_start + 1);    if (!arg_start)	return NULL;    arg_start[strlen(arg_start) - 1] = '\0';	/* Get rid of ')' */    sig_cstr = NULL;	/* Quiet gcc warning about uninitialized variable */    for (method = member_descriptor->methods; method; method = method->next) {	ms = &method->signature;	sig_cstr = convert_java_method_arg_signatures_to_hr_string(cx, ms->arg_signatures,								   ms->num_args, JS_FALSE);	if (!sig_cstr)	    return NULL;	if (!strcmp(sig_cstr, arg_start))	    break;	JS_free(cx, (void*)sig_cstr);    }    JS_free(cx, arg_start);    if (!method)	return NULL;    JS_free(cx, (void*)sig_cstr);        /* Don't bother doing anything if the method isn't overloaded */    if (!member_descriptor->methods->next)	return member_descriptor;    /*     * To speed up performance for future accesses, create a new member descriptor     * with a name equal to the explicit method name, i.e. "cos(double)".     */    member_descriptor = JS_malloc(cx, sizeof(JavaMemberDescriptor));    if (!member_descriptor)        return NULL;    memset(member_descriptor, 0, sizeof(JavaMemberDescriptor));    member_descriptor->id = method_name_id;    member_descriptor->name =        JS_strdup(cx, is_constructor ? "<init>" : JS_GetStringBytes(simple_name_jsstr));    if (!member_descriptor->name) {        JS_free(cx, member_descriptor);        return NULL;    }    member_descriptor->methods = copy_java_method_descriptor(cx, method);    if (!member_descriptor->methods) {	JS_free(cx, (void*)member_descriptor->name);        JS_free(cx, member_descriptor);        return NULL;    }     fun = JS_NewFunction(cx, jsj_JavaInstanceMethodWrapper, 0,			 JSFUN_BOUND_METHOD, NULL, method_name);    member_descriptor->invoke_func_obj = JS_GetFunctionObject(fun);    JS_AddRoot(cx, &member_descriptor->invoke_func_obj);    /* THREADSAFETY */    /* Add the new aliased member to the list of all members for the class */    if (is_static) {	member_descriptor->next = class_descriptor->static_members;	class_descriptor->static_members = member_descriptor;    } else {	member_descriptor->next = class_descriptor->instance_members;	class_descriptor->instance_members = member_descriptor;    }    return member_descriptor;}