This repository was archived by the owner on Mar 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit 6fe9b17
Update Mono.Android.xml for API-26 (#5)
Context: dotnet/android#662
There are three breaking changes in this update which we consider
to be acceptable:
1. Removal of `Android.Service.Quicksettings.TileState`
2. Removal of `Java.Lang.Reflect.Constructor.InterfaceConsts`
3. Removal of `Java.Lang.Reflect.Method.InterfaceConsts`
The `TileState` enum (1) is present due to a type-o: the namespace is
*supposed* to be `Android.Service.QuickSettings` (note the
capital-`S` in `QuickSettings`), and there is also an identical
`Android.Service.QuickSettings.TileState` enum type.
The incorrect `Android.Service.Quicksettings.TileState` type has been
`[Obsolete]` for quite some time, so we're removing it now.
The `InterfaceConsts` types (2, 3) are for `static final int` members
from a Java interface. (In this case, `Constructor` and `Method` are
*classes*, so the `InterfaceConsts` types were coming from interfaces
those types implement.)
Related: https://developer.xamarin.com/guides/android/advanced_topics/api_design/
> All classes that implement a Java interface containing constants
> get a new nested `InterfaceConsts` type which contains constants
> from all implemented interfaces.
However, the `InterfaceConsts` types are only emitted on types which
implement the interface.
In API-25, we had:
// Java
interface Member {
public static final int DECLARED = 1;
public static final int PUBLIC = 0;
// ...
}
class Constructor extends AccessibleObject implements Member {
// ...
}
This resulted in the C# binding:
// C#
partial class Constructor : AccessibleObject, IMember {
public static class InterfaceConsts {
public const int Declared = 1;
public const int Public = 1;
}
}
API-26 changes this: `Constructor` and `Method` no longer directly
implement the `Member` interface. Instead, they inherit from
`Executable`, which implements `Member`:
// Java
class Executable extends AccessibleObject implements Member {
// ...
}
class Constructor extends Executable {
// ...
}
Which results in the binding:
// C#
partial class Executable : AccessibleObject, IMember {
public static class InterfaceConsts {
public const int Declared = 1;
public const int Public = 1;
}
}
partial class Constructor : Executable {
}
*This* is the state of affairs for the "breaking change" in (2, 3):
the `Constructor.InterfaceConsts` and `Method.InterfaceConsts`
types are no longer generated.
However, *these are not breaking changes*.
The removal of e.g. `Constructor.InterfaceConsts` isn't an ABI break,
as it isn't possible for IL to reference any
`Constructor.InterfaceConsts` members: it's a static class with no
methods, only `const` fields. Thus, the `const` value will be
"inlined" at their usage sites, and there are no other members which
can be referenced from IL under normal usage.
Additionally, this isn't an API (source) break either: because the
`InterfaceConsts` type was "moved" to a base class, existing source
code with a C# expression of `Constructor.InterfaceConsts.Default`
will continue to compile as expected, with unchanged semantics.
We thus deem (2, 3) to be acceptable changes.1 parent 49b5789 commit 6fe9b17Copy full SHA for 6fe9b17
1 file changed
+113310
-49456
lines changed+113,310-49,456
Original file line number | Diff line number | Diff line change |
---|
0 commit comments