Kt. Academy Logo
WorkshopsBooksArticlesStore

Advanced Kotlin

You know how to use Kotlin, but do you know the advanced features? What are the consequences of using variance modifiers? What limitations do they introduce, and how can these be overcome? How does property delegation work? How to use reflection? How to implement a KSP or an annotation processor? How is a Kotlin Compiler Plugin implemented? If you want to know the answers to these questions, this book is for you.

This book focuses on the advanced aspects of Kotlin's development. These are often features and tools that developers use daily, even though they don’t know exactly how they work. This book explains them and gives you the knowledge to use these features in your projects.

Who this book is for

This book is for developers with Kotlin experience who want to learn about its advanced features. Readers are expected to have experience in Kotlin development. All the required knowledge can be discovered in the books Kotlin Essentials and Functional Kotlin.

What is covered

This book focuses on advanced Kotlin features, including:

  • Generic variance modifiers
  • Interface and property delegation
  • Kotlin Contracts
  • Kotlin and Java interoperability
  • Multiplatform development
  • Using Kotlin/JS
  • Kotlin reflection
  • Annotation Processor
  • Kotlin Symbol Processor
  • Kotlin Compiler Plugins
  • Static Analysis with custom rules
Marcin Moskała

Marcin Moskała

Marcin Moskala is a highly experienced developer and Kotlin instructor as the founder of Kt. Academy, an official JetBrains partner specializing in Kotlin training, is known for his significant contributions to the Kotlin community. Moskala is the author of several widely recognized books, including "Effective Kotlin," "Kotlin Coroutines," "Functional Kotlin," "Advanced Kotlin," "Kotlin Essentials," and "Android Development with Kotlin."

Beyond his literary achievements, Moskala is the author of the largest Medium publication dedicated to Kotlin. As a respected speaker, he has been invited to share his insights at numerous programming conferences, including events such as Droidcon and the prestigious Kotlin Conf, the premier conference dedicated to the Kotlin programming language.

Chapters available as articles

Kotlin Generic Variance Modifiers

What are out and in, and how do we use them without even knowing.

Covariant Nothing Object

The pattern we are all using, but no-one talks about it.

Variance modifiers limitations

What limitations generic variance modifiers introduce, and how can we ignore them.

Interface Delegation

One of the least known Kotlin features, that can be sometimes found really useful.

Property delegation

What is property delegation, how does it work, and how can we implement our custom property delegate.

Lazy property delegate

What is lazy delegate, and what are its real-life use cases.

Observable and Vetoable delegates

What are observable and vetoable delegates, and what are their real-life use cases.

Map as a property delegate

How do we use Map as a property delegate, and why the result of a famous puzzler should not be surprising.

Kotlin Contracts

Practical review of Kotlin Contracts - a feature we often use, without knowing about it.

Kotlin and Java interoperability: Types

See surprising transitions that happens on types when you interoperate between Kotlin and Java.

Kotlin and Java interoperability: Properties and annotations

Kotlin property is Java getter, setter, field and possibly more. So what to do, when you need to annotate or use a specific JVM element?

Kotlin and Java interoperability: Useful annotations

Learn about useful Kotlin annotations, that decide that it is compiled to on JVM.

Kotlin and Java interoperability: Traps and gotchas

The parts of Kotlin and Java interoperability that might be surprising or counterintuitive.

Using Multiplatform Kotlin

The essence of using multiplatform Kotlin capabilities and definition common elements.

Implementing Multiplatform Kotlin library

How in Kotlin we can use multiplatform capabilities to distribute the same code to multiple platforms.

Implementing Multiplatform Kotlin Mobile

How in Kotlin we can implement Android and iOS projects with shared logic.

JavaScript interoperability

How to interoperate between Kotlin and JavaScript.

Kotlin Reflection: Method and property references

The general hierarchy of Kotlin reference classes, and details about method and property references.

Kotlin Reflection: Class references

All the essential aspects of class references, and a practical object serialization example.

Kotlin Reflection: Type references

Using type references, with practical example of random value generator.

Annotation Processing

Implement your first annotation processor in Kotlin.

Kotlin Symbol Processing

All the essential aspects of KSP in practice.

Kotlin Compiler Plugins

All you need to know about Kotlin Compiler plugins.

Static Code Analysers

All you need to know about Static Code Analysers and Detekt.