aafanasev / kson

Gson TypeAdapter & Factory generator for Kotlin data classes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't use synchronized delegates

aafanasev opened this issue · comments

Now generated code looks like this:

private val adapter by lazy { gson.getAdapter(...) }

Since the evaluation of the delegated properties is synchronized and it's redundant in TypeAdapter case, need to use LazyThreadSafetyMode.NONE mode, which doesn't incur any thread-safety guarantees and the related overhead.