-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[class-parse, generator] Allow showing Kotlin internals via metadata (#…
…793) Fixes: #790 Kotlin compiled for Java Bytecode is an interesting beast, as it has features which aren't directly supported by Java bytecode. One such feature is visibility: Kotlin supports an [`internal`][0] visibility on types and members: internal class Example Java doesn't have a direct equivalent to `internal`; instead, Java Bytecode uses a visibility of *`public`*: % javap Example.class public final class Example { public Example(); } Commit 439bd83 added support to `Xamarin.Android.Tools.Bytecode.dll` for parsing Kotlin metadata. The result is that Kotlin `internal` are marked as *`private`*, which causes them to be *skipped* and not present within `api.xml`, because `class-parse` [doesn't write out `private` members][1]. The result was that `Metadata.xml` could not be used to mark Kotlin `internal` types as `public`, as they didn't exist within `api.xml`, and thus couldn't serve as a "target" for `Metadata.xml`. Improve support for using `Metadata.xml` to update Kotlin `internal` types by making the following changes: * `XmlClassDeclarationBuilder` now emits *all* types, even `private` types. This includes Kotlin `internal` types which were changed to have `private` visibility. * Kotlin `internal` members are emitted into `api.xml` with a new `//*/@visibility` value of `kotlin-internal`. These changes allow the Kotlin declaration: internal class Example { public fun pubFun() {} internal fun intFun() {} } to be emitted into `api.xml` a'la: <class name="Example" visibility="private" …> <method name="pubFun" visibility="public" …/> <method name="intFun$main" visibility="kotlin-internal" …/> </class> [0]: https://kotlinlang.org/docs/visibility-modifiers.html#modules [0]: https://github.com/xamarin/java.interop/blob/b46598a254c20060b107312564e0ec0aee9e33d6/src/Xamarin.Android.Tools.Bytecode/XmlClassDeclarationBuilder.cs#L32-L33
- Loading branch information
Showing
7 changed files
with
89 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters