-
Notifications
You must be signed in to change notification settings - Fork 8
Update Mono.Android.xml to reflect all the changes in api-o-enumification branch #5
Update Mono.Android.xml to reflect all the changes in api-o-enumification branch #5
Conversation
|
This PR leaves one change of interest: <h3>Type Changed: Android.Bluetooth.BluetoothGattServerCallback</h3>
<p>Removed method:</p>
<pre>
<span class='removed removed-method breaking' data-is-breaking>public virtual void OnServiceAdded (ProfileState, BluetoothGattService);</span>
</pre>I understand that this is a fix for Bug #55473, but it still constitutes an ABI break. Is there any way to work around this/provide ABI compatibility? Case in point: searching GitHub for use of
Removing this member will break any existing assemblies with code like the above. One not-fully-explored solution: "just" overload the method: // Current
partial class BluetoothGattServerCallback {
public virtual void OnServiceAdded(ProfileState, BluetoothGattService);
}
// Proposed
partial class BluetoothGattServerCallback {
// New hotness
public virtual void OnServiceAdded(GattStatus status, BluetoothGattService service);
// Old and busted
[Obsolete("Use OnServiceAdded(Android.Bluetooth.GattStatus, Android.Bluetooth.BluetoothGattService)", error:true)]
[Register ("onServiceAdded", "(ILandroid/bluetooth/BluetoothGattService;)V", "GetOnServiceAdded_ILandroid_bluetooth_BluetoothGattService_Handler")]
public virtual void OnServiceAdded(ProfileState status, BluetoothGattService service)
{
this.OnServiceAdded ((GattStatus)(int) status, service);
}
static Delegate cb_onServiceAdded_ILandroid_bluetooth_BluetoothGattService_;
#pragma warning disable 0169
static Delegate GetOnServiceAdded_ILandroid_bluetooth_BluetoothGattService_Handler ()
{
if (cb_onServiceAdded_ILandroid_bluetooth_BluetoothGattService_ == null)
cb_onServiceAdded_ILandroid_bluetooth_BluetoothGattService_ = JNINativeWrapper.CreateDelegate ((Action<IntPtr, IntPtr, int, IntPtr>) n_OnServiceAdded_ILandroid_bluetooth_BluetoothGattService_);
return cb_onServiceAdded_ILandroid_bluetooth_BluetoothGattService_;
}
static void n_OnServiceAdded_ILandroid_bluetooth_BluetoothGattService_ (IntPtr jnienv, IntPtr native__this, int native_status, IntPtr native_service)
{
Android.Bluetooth.BluetoothGattServerCallback __this = global::Java.Lang.Object.GetObject<Android.Bluetooth.BluetoothGattServerCallback> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
Android.Bluetooth.ProfileState status = (Android.Bluetooth.ProfileState) native_status;
Android.Bluetooth.BluetoothGattService service = global::Java.Lang.Object.GetObject<Android.Bluetooth.BluetoothGattService> (native_service, JniHandleOwnership.DoNotTransfer);
__this.OnServiceAdded (status, service);
}
#pragma warning restore 0169
}What I'm not currently sure about is runtime JNI method registration. I think it might be sufficient, because the |
…ttServerCallback) from xamarin/xamarin-android-api-compatibility#5 (comment) (with a handful of fixes as the code just does not build)
|
I don't care about old API that is supposed to be fixed. As long as the new method in the API works it is basically no worse than "nothing else" so I have added the manual binding above with some fixes at d3f8957 and I'm going to update this repo too. |
baf6429 to
b760dc5
Compare
|
The updated commit confuses me; I'd expect Are you sure you updated |
b760dc5 to
fc96341
Compare
|
Sorry, that was unexpected. Updated. |
…tion branch See dotnet/android#662 for all those details. Particularly dotnet/android#662 (comment) for the latest details.
fc96341 to
b580fae
Compare
|
Proposed commit message once merged: There are three breaking changes in this update which we consider
The The incorrect The Related: https://developer.xamarin.com/guides/android/advanced_topics/api_design/
The |
|
However, while writing that up, the parts for (2) and (3) confuse me, as the rationale in that comment is wrong, at least locally: my So I no longer understand why e.g. Perhaps I have an older |
|
Continuing my confusion, <interface abstract="true" deprecated="not deprecated" final="false" name="Member" static="false" visibility="public">
<method abstract="true" deprecated="not deprecated" final="false" name="getDeclaringClass" native="false" return="java.lang.Class<?>" static="false" synchronized="false" visibility="public">
</method>
<method abstract="true" deprecated="not deprecated" final="false" name="getModifiers" native="false" return="int" static="false" synchronized="false" visibility="public">
</method>
<method abstract="true" deprecated="not deprecated" final="false" name="getName" native="false" return="java.lang.String" static="false" synchronized="false" visibility="public">
</method>
<method abstract="true" deprecated="not deprecated" final="false" name="isSynthetic" native="false" return="boolean" static="false" synchronized="false" visibility="public">
</method>
<field deprecated="not deprecated" final="true" name="DECLARED" static="true" transient="false" type="int" type-generic-aware="int" value="1" visibility="public" volatile="false">
</field>
<field deprecated="not deprecated" final="true" name="PUBLIC" static="true" transient="false" type="int" type-generic-aware="int" value="0" visibility="public" volatile="false">
</field>
</interface>Confirming that these members have not in fact been removed from It's doubly odd that only Furthermore, as per the updated So this looks like an acceptable change, but for different reasons: it isn't that With this in mind, this is not an ABI break: it's not possible for the It's also not an API (source) break: the new Consequently, the PR is correct. It's the commit message which requires editing. |
…ttServerCallback) from xamarin/xamarin-android-api-compatibility#5 (comment) (with a handful of fixes as the code just does not build)
Context: #5 (comment) Before API-26, `Java.Lang.Reflect.Constructor` and `Java.Lang.Reflect.Method` had nested `InterfaceConsts` types. In API-26, `Constructor` and `Method` were updated with a different, *common*, base class: `Java.Lang.Reflect.Executable`. `Executable` got the `InterfaceConsts` nested type, and `Constructor` and `Method` "lost" them, because it was "moved" to the base class. This is fine API-wise (`Constructor.InterfaceConsts` is still something the C# compiler will accept) and ABI-wise (`InterfaceConsts` only contained `const` members, so -- unless using reflection -- it's not possible for IL to contain a member reference within that type). However, `mono-api-html` doesn't know that. Add a `inter-api-extra-v7.1-v8.0.txt` file to pass the following additional arguments to `mono-api-html`: -r 'Java.Lang.Reflect.Constructor.InterfaceConsts' -r 'Java.Lang.Reflect.Method.InterfaceConsts' This prevents `mono-api-html` from erroring on those changes.
See dotnet/android#662 for all those details.
Particularly dotnet/android#662 (comment)
for the latest details.