Skip to content

[Mono.Android] Generate default interface members for API-30+. #4353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2020

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Mar 3, 2020

Context: dotnet/java-interop#509

Using the new features provided by C#8 to provide bindings that mirror the original Java android.jar more closely.

Step 1 - Default Interface Members

Enable --lang-features=default-interface-methods to start generating default methods on all interfaces in Mono.Android.dll API-30+.

@jpobst jpobst force-pushed the monoandroid-csharp8 branch from 15c0723 to 4c89765 Compare March 4, 2020 15:59
@jpobst jpobst force-pushed the monoandroid-csharp8 branch from 4c89765 to 9046473 Compare March 4, 2020 16:27
@jpobst jpobst marked this pull request as ready for review March 4, 2020 20:11
@jpobst jpobst requested a review from jonpryor as a code owner March 4, 2020 20:11
@jpobst jpobst requested a review from gugavaro March 4, 2020 20:11
@jonpryor jonpryor merged commit 54beb90 into master Mar 5, 2020
@jonpryor jonpryor deleted the monoandroid-csharp8 branch March 5, 2020 16:38
jonpryor added a commit that referenced this pull request Mar 6, 2020
Context: dotnet/java-interop#509

Use `generator --lang-features=default-interface-methods` so that we
start binding [Java interface default methods][0] within `android.jar`
and `Mono.Android.dll`, for API-R.

*Note*: `Microsoft.DotNet.ApiCompat.exe` does not currently understand
C#8 [default interface members][1], which we use to bind Java interface
default methods.  As such, it reports an error for *every added*
default interface member, e.g.

	InterfacesShouldHaveSameMembers : Interface member 'Android.App.Application.IActivityLifecycleCallbacks.OnActivityPostCreated(Android.App.Activity, Android.OS.Bundle)' is present in the implementation but not in the contract.

We are investigating improving `Microsoft.DotNet.ApiCompat.exe` so
that it doesn't report such changes as incompatible.

[0]: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html
[1]: https://github.com/dotnet/csharplang/blob/f7952cdddf85316a4beec493a0ecc14fcb3241c8/proposals/csharp-8.0/default-interface-methods.md
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants