Classes final by default

This is not right decision. The most of classes are final/sealed in all my C#/Java/Kotlin. For example, Spring requires to have open only small portion of classes (such as marked with Configuration annotation).

final classes allow JVM to do a lot of optimizations. Moreover, it allows static processors to validate your code. In my experience, I found several issues in the legacy code after marking class final (sealed in C# terms, compiler shows me, that cast will be never succeeded).

So, kotlin language has right direction of choice: class inheritance should be disabled by default.

3 Likes