Commit eadd3bd
authored
[Mono.Android] Unbind Cursor.setNotificationUris() (#5124)
Fixes: #5027
Context: dotnet/java-interop#699
The [`Cursor.setnotificationUris(ContentResolver, List<Uri>)`][0]
interface default method was added in API-29.
This introduces an issue when implementing `Android.Database.ICursor`
in API-30+: when binding a Java class that implements `Cursor`:
// Java
public class MyCursor implements android.database.Cursor {
// …
}
In the binding `generator` emits for `MyCursor`, the Java-to-managed
marshal method to support `Cursor.setNotificationUris()` does not
compile, as it tries to use a generic type -- `IList<T>` -- without
providing any generic type parameters:
// C# binding
public partial class MyCursor : Java.Lang.Object, ICursor {
static void n_SetNotificationUris_1 (IntPtr jnienv, IntPtr native__this, IntPtr native_cr, IntPtr native_uris)
{
var __this = Java.Lang.Object.GetObject<MyCursor> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
var cr = Java.Lang.Object.GetObject<ContentResolver> (native_cr, JniHandleOwnership.DoNotTransfer);
var uris = (System.Collections.Generic.IList`1) Java.Lang.Object.GetObject<System.Collections.Generic.IList`1> (native_uris, JniHandleOwnership.DoNotTransfer);
__this.SetNotificationUris (cr, uris);
}
}
We had thought that dotnet/java-interop@262743b47 addressed this
issue, but we were mistaken.
The `generator` fix for this scenario seems tricky, so as a workaround
for now we can simply remove the `Cursor.setNotificationUris()` default
method so users can implement the interface.
(Although the method was added in API-29, we don't support
Default Interface Members in API-29, so it was ignored. Thus, this
problem doesn't show up until API-30+ is used.)
[0]: https://developer.android.com/reference/android/database/Cursor#setNotificationUris(android.content.ContentResolver,%20java.util.List%3Candroid.net.Uri%3E)1 parent b17f8aa commit eadd3bd
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1626 | 1626 | | |
1627 | 1627 | | |
1628 | 1628 | | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
1629 | 1633 | | |
1630 | 1634 | | |
1631 | 1635 | | |
| |||
0 commit comments