If you’re keen to get started now, I recommend checking out Arrow Meta, they have done an amazing job of creating a platform for developing plugins right now. Despite the initial learning curve, the possibilities this platform opens are huge, and I encourage everyone to give it a try. Kotlin compiler plugins are a perfect tool for code generation and meta programming. Planning aheadįirst of all, let’s take a closer look at the code we are going to generate: If Kotlin does not generate these functions by itself, let’s help it to do so! This article goes through the implementation of the compiler plugin to this purpose. This problem popped up when I was researching Kotlin compiler plugins and this is how it can be solved in an elegant way. It seemed to be a job more fitting for a code generation tool than a human being. However, in the back of my mind, I just could not understand why Kotlin compiler does not generate readResolve by itself for JVM targets. Given that here, at Bumble - the parent company operating Badoo and Bumble apps -, we don’t use Serializable anywhere except for Bundle, we decided to keep is for each clause of when expression, and forget about that problem altogether. The author suggests an amazing solution involving adding the readResolve method to each object implementing java.io.Serializable rather than using instance checks.ĭespite this approach seemingly being the most correct one to go with, supporting it might be quite a nightmare. Some time ago, I read an article describing a problem experienced with Kotlin objects and serialization using built-in Java methods. Fixing serialization of Kotlin objects once and for all
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |