[Xamain.Android.Tools.Bytecode] Hide private Kotlin default constructors. #1206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Kotlin.Stdlib
contains thepublic
classkotlin.io.encoding.Base64
which is not intended to be instantiated by external users. Thus it only contains aprivate
default constructor.https://github.com/JetBrains/kotlin/blob/3fbb7bc92086bdf3bde123a8f774bce25b19ef37/libraries/stdlib/src/kotlin/io/encoding/Base64.kt
This compiles into the following Java constructors:
Previously we believed that a synthetic default constructor would always end in an
int
and aDefaultConstructorMarker
parameter, however this one does not.https://github.com/xamarin/java.interop/blob/651de42732d194cee5a45fae45feda37706a8c16/src/Xamarin.Android.Tools.Bytecode/Kotlin/KotlinUtilities.cs#L100-L103
This synthetic constructor causes us to generate some bizarre constructors:
This commit extends our Kotlin default constructor marker detection logic to look for any synthetic constructor whose final parameter is
DefaultConstructorMarker
to handle this additional case.With the change,
Kotlin.IO.Encoding.Base64
no longer generates apublic
constructor.