Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Tools.Bytecode] Kotlin name shadowing support (#573)
Fixes: #571 Don't mark `public` Kotlin methods as `private` if they "shadow" -- share the same name as -- a private property or field. If a library uses Kotlin's `NAME_SHADOWING` we incorrectly match the `private` property/field to the `public` method and mark the methods as `private`. Given Kotlin: @Suppress("NAME_SHADOWING") public class NameShadowing { // Property and method private val count: Int = 3 fun count(): Int = count // Field and method private var hitCount = 0 fun hitCount(): Int = hitCount // Property and setter private var type = 0 fun setType(type: Int) = { println (type); } } Then the public methods `NameShadowing.count()`, `NameShadowing.hitCount()`, and `NameShadowing.setType()` were not present within the C# binding. Support name shadowing by only considering `getFoo()` methods as potential property getters, instead of allowing `foo`. (Allowing `foo` was likely incorrect anyways.) Additionally, when considering if a method is a potential property setter, also check that the method's return type is `void`. [Xamarin.Android.Tools.Bytecode] Kotlin name shadowing support (#573)
- Loading branch information