Skip to main content

jvm

Helpful Kotlin APIs for Java Developers

·11 mins

One of the major benefits of Kotlin as a JVM language is that you can use any and all Java libraries natively. However, sometimes, Kotlin has better (or at least more idiomatic) alternatives to the native Java libraries. Over the years, I’ve coached a lot of Java developers at various experience levels on how to effectively use Kotlin, and it’s a very common pattern for them to not know the standard Kotlin library and choose the “Java way” instead of the “Kotlin way”. This article will cover some of the more common cases where I see that happen.

Values, Records, and Primitives (Oh My!) - Kotlin & Java's 'Valuable' Future

·24 mins

A couple years ago, I did a semi-deep-dive on Kotlin Inline Classes and how they were implemented. Kotlin 1.5 was just released, and with it came the evolution of inline classes into the start of value classes. Meanwhile, Kotlin 1.5 also now supports JVM Records, which at first read might sound like a very similar concept. Finally, with JEP-401 Java is going to bring “primitive classes” which also sounds like a very similar concept. This can sound all very confusing, so let’s take a look!

A Semi-Deep Dive into Kotlin Inline Classes

·15 mins

With Kotlin 1.3, a new experimental feature called “Inline Classes” is now available. This post is a somewhat deep dive into the nature of the implementation, how it works, where the edges are, and what limitations currently exist. Let’s take a look!

What's the Deal with @JvmDefault?

·5 mins

Kotlin has an annotation called @JvmDefault which, like most of the “Jvm” prefixed annotations, exists to help massage the Kotlin compiler output to match Java classes in a certain way. This annotation was added in 1.2.40, and has now seen some experimental enhancements in 1.2.50, so it seems worth exploring what this is all about.