env->CallIntMethod(java_obj, hashCodeMID), (int) aXPCOMObject, iid_str));
(PRUint32) env->CallIntMethod(java_obj, hashCodeMID), (PRUint32) aXPCOMObject, iid_str));
CreateJavaProxy(JNIEnv* env, nsISupports* aXPCOMObject, const nsIID& aIID,                jobject* aResult){  NS_PRECONDITION(aResult != nsnull, "null ptr");  if (!aResult)    return NS_ERROR_NULL_POINTER;  nsCOMPtr<nsIInterfaceInfoManager> iim = XPTI_GetInterfaceInfoManager();  NS_ASSERTION(iim != nsnull, "Failed to get InterfaceInfoManager");  if (!iim)    return NS_ERROR_FAILURE;  // Get interface info for class  nsCOMPtr<nsIInterfaceInfo> info;  nsresult rv = iim->GetInfoForIID(&aIID, getter_AddRefs(info));  if (NS_FAILED(rv))    return rv;  // Wrap XPCOM object  JavaXPCOMInstance* inst = new JavaXPCOMInstance(aXPCOMObject, info);  if (!inst)    return NS_ERROR_OUT_OF_MEMORY;  // Get interface name  const char* iface_name;  rv = info->GetNameShared(&iface_name);  if (NS_SUCCEEDED(rv)) {    jobject java_obj = nsnull;    // Create proper Java interface name    nsCAutoString class_name("org/mozilla/xpcom/");    class_name.AppendASCII(iface_name);    jclass ifaceClass = env->FindClass(class_name.get());    if (ifaceClass) {      java_obj = env->CallStaticObjectMethod(xpcomJavaProxyClass,                                             createProxyMID, ifaceClass,                                             NS_REINTERPRET_CAST(jlong, inst));      if (env->ExceptionCheck())        java_obj = nsnull;    }    if (java_obj) {#ifdef DEBUG_JAVAXPCOM      char* iid_str = aIID.ToString();      LOG(("+ CreateJavaProxy (Java=%08x | XPCOM=%08x | IID=%s)\n",           env->CallIntMethod(java_obj, hashCodeMID),           (int) aXPCOMObject, iid_str));      PR_Free(iid_str);#endif      // Associate XPCOM object with Java proxy      rv = gNativeToJavaProxyMap->Add(env, aXPCOMObject, aIID, java_obj);      if (NS_SUCCEEDED(rv)) {        *aResult = java_obj;        return NS_OK;      }    } else {      rv = NS_ERROR_FAILURE;    }  }  // If there was an error, clean up.  delete inst;  return rv;}