Skip to content
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

[XAT.Bytecode] Kotlin internal interfaces need to be set to package-private #645

Merged
merged 1 commit into from
May 18, 2020

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented May 14, 2020

Context: dotnet/android#4661

In 439bd83 we made a change to hide Kotlin internal members as we shouldn't be binding them. However a public class can inherit an internal interface, so we need to emit those interfaces.

This change emits the internal interface as package-private (visibility="" in api.xml parlance). This allows us to resolve the interface and thus successfully bind the class.

In C#-land, the interface is not actually bound and the C# class doesn't actually implement it. This has no effect to the public API end user, who shouldn't be seeing the internal interface anyways . If a user really wants to publicly expose the interface, its visibility can be changed via metadata.

@jpobst jpobst marked this pull request as ready for review May 14, 2020 16:14
@jonpryor jonpryor merged commit 1708d8a into master May 18, 2020
@jonpryor jonpryor deleted the internal-interface branch May 18, 2020 19:36
jonpryor pushed a commit that referenced this pull request May 18, 2020
Context: dotnet/android#4661

In 439bd83, we made a change to hide Kotlin `internal` members as we
shouldn't be binding them.  However a `public class` can inherit from
an `internal interface`, so we need to emit those interfaces.

Instead, emit `internal interface` types as "package private" types;
`visibility=""` in `api.xml` parlance.  This allows us to resolve the
`interface` and thus successfully bind the `class`.  

In C#-land, the `interface` is not actually bound and the C# class
doesn't actually implement it.  This has no effect to the public API
end user, who shouldn't be seeing the `internal interface` anyways.
If a user really wants to publicly expose the `interface`, its
`visibility` can be changed via `metadata`.

***Note***: Changing the `visibility` of a type may result in
subsequent Java Callable Wrapper generation errors, if/when a
Java Callable Wrapper attempts to implement the package-private type.
@jpobst jpobst added this to the 10.4 (16.7 / 8.7) milestone May 19, 2020
@jpobst
Copy link
Contributor Author

jpobst commented May 19, 2020

Release Notes

- [Java.Interop GitHub PR 645](https://github.com/xamarin/java.interop/pull/645):
  Fixed an issue where Kotlin internal interfaces were being ignored, causing any
  public classes that implemented them to not 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.

2 participants