In this episode, we talk to Jeffrey Van Gogh, Engineering Manager for Android Studio, and Mads Ager, Software Engineer and Tech Lead at Google. They work on the D8 dexer, the R8 shrinker, and the Kotlin compiler.

We touch on the structure of a compiler – from frontend to backend – and provide an overview of the structure of the Kotlin compiler in particular.

We also get some insight into Google’s main reason for working on the Kotlin compiler – the Jetpack Compose user interface framework project – and what this entails for their involvement.

We discuss the impact of Kotlin’s new IR (intermediate representation) compiler, from extending Kotlin’s functionality and rewriting code to the challenges of working with the internals of a compiler.

Additionally, Mads gives us an overview of the other compilers that the Android team works on. One is D8, the tool Android Studio and the Android Gradle plugin use to compile a project’s Java bytecode into DEX bytecode that’s ready to run on Android devices. It also enables the use of Java 8 language features in an app’s code. The other is R8, a Proguard-compatible tool for program shrinking and minification that turns JVM byte code into optimized DEX code. We also learn about how it enables the use of more modern features on older Android devices through the process of desugaring.

Jeffrey goes on to provide some insight into the work of the Kotlin language committee, which helps move the Kotlin programming language forward safely, and he introduces the Kotlin Symbol Processor – a new way to generate code based on annotations in your Kotlin code, without having to write your own compiler plugins. We learn how KSP will allow the creation of ORMs (object-relational mapping) or DI (dependency injection) frameworks that need to generate code at compile time.

Mads discusses the new Kotlin compiler frontend and how it helps speed up the edit-compile-deploy cycle for developers. We then explore how these changes relate to the overall developer experience and discuss a variety of smaller topics.

#kotlin

Talking Kotlin: Contributing to the Kotlin Compiler
2.10 GEEK