shall we use Kotlin?
CXwudi opened this issue · 3 comments
CXwudi commented
- getter/setter problem - kotlin call from java link
- configuration properties data class - use
init{}
and the primary constructor should work - Gradle? no, use Maven to speed up IDE's project build time
- JSON parsing, tree node approach,
data class by map approach, or swagger with our own fixing approach?- if tree node, can we have [] operator working as getter and setter?
-
if data class by map, how to deal withthere is no tool to generate that kind of class. maybe we could write an issue for a JSON to kotlin pluginfield?
? - if swagger, how is the maintainability? can it save time from the other two approaches?
- An: swagger approach. it is good at having enums, proper time format. by doing our own fix, we help to make a great open-source vocadb client.
- so kotlin has special definitions for properties, does Java getters return
type?
ortype
? it istype
, honor project poc proved it - but with
Xjsr305=strict
, all@Nullable
java function (including getter) wil returnType?
in kotlin, which sometime is useful, sometime is annoying- An: depending on situation, either write
orThrow()
or just!!
- An: depending on situation, either write
CXwudi commented
We are now trying Kotlin in vvd-taskproducer
CXwudi commented
Our answer to Shall we use kotlin is
yes, but only on kotlin/jvm, where JSON models preferred to stay in Java.
CXwudi commented
At this time, vvd-taskproducer
is pretty much done, and using Kotlin is a good success