Shopify / android-testify

Add screenshots to your Android tests
https://testify.dev
MIT License
231 stars 23 forks source link

Rename rootViewId setter for Java interoperability #232

Closed jaredh closed 3 years ago

jaredh commented 3 years ago

What does this change accomplish?

When rootViewId was made protected it inadvertently broke interop with Java subclasses due to the conflicting method signatures of the generated setter and this function https://github.com/Shopify/android-testify/blob/1ad32a9f5777f07768773c536a36ed76fdbdfb64/Library/src/main/java/com/shopify/testify/ScreenshotRule.kt#L218

This fix renames the setter for Java classes while Kotlin property accessors remain unchanged.

How have you achieved it?

  1. Used JvmName annotation and rename the Java setter to setRootViewIdResource

Tophat instructions

  1. Using 1.1.0-beta2 Create a class that extends ScreenshotRule in Java and it will fail to compile due to conflicting method signatures.
  2. Using a build of the Library from this branch, the previous class should compile successfully.