Kotlin Idioms

It has been a while since I start using Kotlin as my first class language when developing Android app. It's efficiency and easy to use, though it might have something we all should pay attention to. I think it's time to origanize some useful idioms that we should apply when writing Kotlin :)

It tells the compiler that the annotation is stored in binary output and visible for reflection, and it targets to fields or properties, which means that you can attach to the fields or properties, like this in Java:

@Exclude
private String name;

or in Kotlin:

@Exclude
var name: String? = null

Only a question: are the code blocks the same after being compiled? The answer is NO. The property in Kotlin equals the below things in Java: a private field, a public setter of the field and a public getter of the field. The bytecode of the property is like this: