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

Example migration of Android application from Java to Kotlin - DO NOT MERGE #9

Open
wants to merge 4 commits into
base: java
Choose a base branch
from

Conversation

dbacinski
Copy link
Owner

@dbacinski dbacinski commented Nov 3, 2017

Migration findings and solved issues:

  • Java protected (package-private + inheritance) != Koltin protected (private + inheritance)
  • there is no package-private scope to hide classes inside of package and expose just a public interface
  • tests that verifies nulls are replaced with non-nullable Kotlin types
  • nullable view has to be guarded with .?, because smart cast does't work for var-s
  • builders can be replaced with constructor and named parameters
  • Mockito is failing on final classes (Kotlin default), can be fixed by Mock Maker
  • Mockito any() doesn't work for objects in Kotlin, alternative any() from mockito-kotlin can be used
  • when is a keyword in Kotlin, use BDDMockito.given() instead
  • Gradle annotationProcessor is replaced by kapt

Check Files changed tab to see files diff.

- Java protected (package-private + inheritance) != Koltin protected (private + inheritance)
- there is no package private scope to hide classes inside of package and expose just a public interface
- removed logic and tests that verifies nulls
- nullable view has to be guarded with .?, because smart cast does't work for var-s
- builders replaced with data classes
- Mockito fails on closed classes, fixed by Mock Maker
- Mockito any() doesn't work in Kotlin, used alternative from mockito-kotlin
- when is a keyword in Kotlin
- replaced annotationProcessor with kapt
@dbacinski dbacinski self-assigned this Nov 3, 2017
@dbacinski dbacinski changed the title DO NOT MERGE - Migration from Java to Kotlin DO NOT MERGE - Example migration from Java to Kotlin Nov 3, 2017
@dbacinski dbacinski changed the title DO NOT MERGE - Example migration from Java to Kotlin Example migration from Java to Kotlin - DO NOT MERGE Nov 3, 2017
@dbacinski dbacinski changed the title Example migration from Java to Kotlin - DO NOT MERGE Example migration of Android application from Java to Kotlin - DO NOT MERGE Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant