Danger signs

Converting huge and complex Java classes into Kotlin is still an option to do. Anyway, provide proper unit or instrumentation tests so the functionality of these classes is retested after conversion. If any of your tests fails, double-check the causes of that failure.

The classes you want to migrate can migrate in the following two ways:

  • Automatic conversion
  • Rewriting by hand

In case of huge and complex classes, both approaches can give us certain drawbacks. Fully automatic conversion can sometimes give you the code that is not the prettiest code to look at. So, after you do it, you should recheck and reformat something. The second option can take you a lot of time.

Conclusion--you can always use the original Java code. From ...

Get Mastering Android Development with Kotlin now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.