-
Poko goes multiplatform ⇗
August 9, 2023
Poko is a Kotlin compiler plugin that generates equals, hashCode, and toString functions for annotated classes based on their properties. Inspired by Jake Wharton’s blog post on maintaining compatibility in public APIs , it partially mimics the behavior of Kotlin data classes while leaving out the copy and componentN functions, which are difficult to maintain without breaking API compatibility. Our Paraphrase and Redwood runtimes use Poko. The equals, hashCode, and toString functions are familiar to all JVM developers.…
-
How Poko works
December 1, 2021
The Kotlin compiler’s job is to convert source code into byte code. Compiler plugins like Poko are able to intercept a representation of the source code during compilation and affect the produced byte code. To this end, Poko’s purpose is fairly straightforward: for any source class with the @Poko annotation, produce byte code that uses that class’s primary constructor properties in three overridden functions. To complicate things, Kotlin added a new compiler backend in 1.…
-
Flexible configuration with Deferred Resources ⇗
June 21, 2021
Our feature libraries, which include UI, have a number of varying requirements regarding configuration by our customers. (My colleague Hari wrote about one such library’s requirements here .) Resources (text, colors, images, etc.) are a common type of configuration, and can be defined in various ways—typically in code, resources, or theme attributes. We created Deferred Resources to support such configurations, and with it our customers can consistently declare configuration properties from any of these common sources:…
-
Monitoring binary compatibility on a pre-stable project
April 28, 2020
The open-source Kotlin binary compatibility validator is a great tool. When added to a project, it fails the build on any change to the public API surface. If a public API change is intentional, ./gradlew apiDump fixes the build by updating the summary of the public API in source control. If you maintain a library that is consumed as a compiled binary, it is wise to use some form of binary compatibility validation, and this is the easiest such tool I know of.…