@brandonlamb, thanks, great list of features.
But I think that the best selling points
to Java devteam are:
-
Greatest thing: Java codebase will benefit from Kotlin code/libraries because of inserted
@Nullable
and@NotNull
annotations visible from Java call site. - Those annotations generated by Kotlin compiler will indirectly reduce NPE issues in Java.
- This handled well in IDE’s (check IntelliJ IDEA 2016.3 Help :: @Nullable and @NotNull Annotations)
- Language fixed lots of annoying Java design flaws, like:
- concise POJO declaration (solved by
data
classes) - singleton design pattern (solved by
object
classes) - static methods - not OOP concept (solved by
extension functions
andcompanion objects
) - missing core immutable collections (solved by Kotlin standard library, 100% compatible with JCF)
- verbose generics (solved by Kotlin Generics)
- many Java puzzlers targeted (more details here: Kotlin vs Java puzzlers - Svetlana Isakova on Vimeo)
- hard-to-develop DSL’s (solved by
extention functions
andextension functions with receivers
) - operator overloading and check for equality, not identity (solved by
==
operator, etc.) - declarations redundancy (solved by
var
,val
,primary constructor
, etc.) - Java language concept of checked exception (all exceptions are unchecked)
- Java method overloading maintainability (solved by
default method parameters
) - No need to wait for a new project, Kotlin can be easily integrated into existing Java project.
- No “black magic” under the hood: every Kotlin language feature can be easily explained to Java guy.
- Kotlin classes/annotations/enums/objects/companions/interfaces looks pretty convenient from Java side.
- Almost all NPE/KNPE exception stacktraces leads to the place, where the non-null object becomes null, thanks to inserted
precondition checks
by Kotlin compiler.
IMO, this is the most important improvements that can help java devteam to produce more stable code in less time.