On Jan 3, 2013, at 4:32 PM, Jeremy A. Kolb - ARA/NED <[email protected]> wrote:
> Furthermore, In:
>
> [Register("bulkInsert",
> "(Landroid/net/Uri;[Landroid/content/ContentValues;)I", "")]
> public int BulkInsert(Android.Net.Uri url, ContentValues[] values)
> {
> IntPtr num1 = JNIEnv.NewArray<ContentValues>(values);
> ...
> if (values != null)
> {
> JNIEnv.CopyArray<ContentValues>(num1, values);
> JNIEnv.DeleteLocalRef(num1);
> }
> return num2;
> }
>
> Why is the array copied back in after the function call? values shouldn’t
> have changed.
_You_ know that. The generator does not; it can change on a method-by-method
basis, and the generator needs to generate code to support it.
> url certainly doesn’t get the same treatment.
`url` isn't an array, and thus has "pass by value" semantics.
For example, consider this potential Java method:
public int bulkInsert(Uri url, ContentValues[] values) {
url = new Url (...);
values [0] = new ContentValues (...);
}
The caller of `bulkInsert()` will _not_ be able to see that bulkInsert()
modified `url`. That is _not_ true for `values[0]`; the caller _will_ be able
to see the change performed to `values[0]`, were it to be changed.
- Jon
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid