Skip to content

[generator] Don't invalidate interface if we invalidate a static method on it. #660

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
Jun 8, 2020

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Jun 8, 2020

Fixes #588

If we cannot bind a method on an interface we mark the interface as unbindable and omit the interface from the generated code (and anything that depends on it). This is because an interface with a missing method cannot be implemented in C#.

However if the method is static we can remove the method but still keep the interface, as the user is not required to implement the static method. This PR makes this change to keep the interface.

Note we already properly handled DIM, this adds support for static methods as well.

@jpobst jpobst marked this pull request as ready for review June 8, 2020 15:37
@jonpryor jonpryor merged commit 5dcf896 into master Jun 8, 2020
@jonpryor jonpryor deleted the static-dim branch June 8, 2020 19:57
jonpryor pushed a commit that referenced this pull request Jun 11, 2020
#660)

Fixes: #588

If we cannot bind a method on an interface we mark the interface as
unbindable and omit the interface from the generated code, and
invalidate anything that depends on the interface.  This is because
an interface with a missing method cannot be implemented in C#.

However, if the method is `static` then we *can* remove the method
while keeping the interface, as the user is not required to implement
the static method.

Update `GenBase.OnValidate()` so that invalid static methods don't
invalidate their declaring interface.

Note we already properly handled Default Interface Methods, this
adds support for `static` methods as well.
@jpobst jpobst added this to the 10.4 (16.7 / 8.7) milestone Jun 15, 2020
@jpobst
Copy link
Contributor Author

jpobst commented Jun 15, 2020

Release Notes

- [Java.Interop GitHub PR 660](https://github.com/xamarin/java.interop/pull/660):
  Don't mark an interface as "can't be bound" if a static method on it cannot be bound.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 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.

Do not invalidate binding an interface if a static method cannot be bound
2 participants