I'm curious why does Kotlin create a class impleme...
# getting-started
j
I'm curious why does Kotlin create a class implementation instead of default methods when creating an interface with methods that have a body? (I now you can change that)
t
probably so it can support earlier versions of Java that don’t have default methods
j
It was not possible to do so with bytecode < JVM 8, so they had to do it another way. When compiling to bytecode 8+, you can now choose to use default methods (it might even be the default now). (remember the initial target was Android)
1
j
Ah okay thanks!
e
Android was not the initial target, I don't know why people think that.
☝️ 1
c
remember the initial target was Android
Not exactly. Kotlin existed for like, 7 years before Google adopted it for Android. Jetbrains created it initially for their own use, which at the time was on Java 6. Kotlin has always been a much bigger thing than just Android
e
https://blog.jetbrains.com/kotlin/2011/07/hello-world-2/ a bit of a retrospective around the time of 1.0
Ten years of Java development led us to feeling that our productivity at JetBrains could be improved significantly by using a modern JVM language alongside Java.
exactly, the connection with Android only came as the community started using it later, with Google picking it up after that
j
Fair enough, that was not quite correct. They did have to maintain compat with JDK < 8 even until recently because of Android though, while the rest could more easily upgrade to more recent JDKs
j
Do you need another compiler argument when using the compiler option -Xjvm-default=all? Because I get a "Inheritance from an interface with 'JvmDefault'...' error
g
because of Android though, while the rest could more easily upgrade to more recent JDKs It's not exactly correct either. Even server java was not completely java 8+, there is a bunch of older big projects which still using java 6, you can check any Java survey for the last 5 years. I agree, Android is a big factor later, but Android app a lot easier to migrate on Java 8 bytecode than a big enterprise server app, it supported for at least 4 years on d8
👌 2