JetBrains/kotlin
JVM modifier plugins (allopen, noarg, sam-with-receiver, lombok)
Active contributors: Dmitriy Novozhilov, Alexander Udalov, Kirill Rakhman
A small family of compiler plugins exists to make Kotlin friendlier to Java/JVM frameworks that have specific expectations about declaration shape — Spring, JPA/Hibernate, Lombok, and frameworks that lean on SAM-conversion conventions. Each plugin is small, but together they unblock a substantial fraction of corporate Kotlin adoption on the JVM.
This page batches them because they share a common shape: each one tweaks declarations matching annotation criteria, and each is wrapped by KGP and Maven.
allopen — open declarations matching annotations
plugins/allopen/ makes Kotlin classes "open" (overrideable) when they (or their ancestors) carry one of a configured list of annotations. Spring needs classes with @Component, @Service, etc. to be subclassable for AOP; Hibernate needs @Entity classes to be subclassable for lazy-loading proxies. Without this plugin, you'd have to hand-write open on every class.
Configuration in KGP:
plugins { kotlin("plugin.allopen") version "..." }
allOpen {
annotation("org.springframework.stereotype.Component")
annotation("javax.persistence.Entity")
}The Spring-specific kotlin-spring and JPA-specific kotlin-jpa Gradle plugins are thin pre-configurations on top of allopen — they ship with the standard Spring/JPA annotation lists pre-set.
| Module | Path |
|---|---|
| Compiler plugin | plugins/allopen/allopen-cli/, plugins/allopen/allopen.k1/, plugins/allopen/allopen.k2/ |
| KGP wrapper | libraries/tools/kotlin-allopen/ |
| Maven wrapper | libraries/kotlin-maven-allopen/ |
noarg — synthesize no-arg constructors
plugins/noarg/ synthesizes a (private or public, configurable) no-argument constructor for any class matching a configured annotation list. JPA requires an entity to have a no-arg constructor for proxy creation; Kotlin's data class doesn't have one by default. The plugin gives you "JPA happy entities" without inventing dummy default values.
Configuration:
plugins { kotlin("plugin.noarg") version "..." }
noArg {
annotation("javax.persistence.Entity")
}| Module | Path |
|---|---|
| Compiler plugin | plugins/noarg/noarg-cli/, plugins/noarg/noarg.k1/, plugins/noarg/noarg.k2/ |
| KGP wrapper | libraries/tools/kotlin-noarg/ |
| Maven wrapper | libraries/kotlin-maven-noarg/ |
sam-with-receiver — SAM conversion with extension receiver
plugins/sam-with-receiver/ adjusts SAM (single-abstract-method) interface conversion so the receiver of a Kotlin lambda becomes the SAM interface's argument, allowing builder-style DSLs. Used by Gradle's Kotlin DSL ("groovy-style closure" emulation) and similar.
Configuration:
plugins { kotlin("plugin.sam-with-receiver") version "..." }
samWithReceiver {
annotation("org.gradle.api.HasImplicitReceiver")
}| Module | Path |
|---|---|
| Compiler plugin | plugins/sam-with-receiver/ |
| KGP wrapper | libraries/tools/kotlin-sam-with-receiver/ |
| Maven wrapper | libraries/kotlin-maven-sam-with-receiver/ |
lombok — Lombok interop
plugins/lombok/ reads Lombok-generated Java methods (@Getter, @Builder, etc.) so Kotlin code can call them as if they were declared. Lombok generates Java methods at compile time via annotation processing, and without this plugin the Kotlin frontend would not see them.
The plugin teaches the Kotlin frontend to recognize Lombok's annotations and synthesize the corresponding methods in the descriptor/FIR symbol space.
Configuration:
plugins { kotlin("plugin.lombok") version "..." }
kotlinLombok { lombokConfigurationFile(file("lombok.config")) }| Module | Path |
|---|---|
| Compiler plugin | plugins/lombok/ |
| KGP wrapper | libraries/tools/kotlin-lombok/ |
| Maven wrapper | libraries/kotlin-maven-lombok/ |
Common pattern
All four plugins:
- Read a list of "marker" annotations from configuration.
- Walk the FIR (or descriptors, in K1) looking for declarations the markers apply to.
- Modify the declaration's flags (allopen → set
open), declare synthetic members (noarg → declare<init>(), lombok → declare getters), or change SAM-conversion behavior (sam-with-receiver).
This makes them excellent first reading for anyone learning the FIR extension API, since each is small and the transformation is concentrated.
Tests and integration
Each plugin has its own tests/ directory under plugins/<name>/. KGP's integration tests exercise the full pipeline (libraries/tools/kotlin-gradle-plugin-integration-tests/) for the most common configurations.
Where to start
To learn the FIR extension API: read plugins/allopen/allopen.k2/ — it's the simplest. To prototype your own marker-based plugin: copy plugins/plugin-sandbox/ and adapt.
See plugins/index.md for the broader plugin landscape and tools/kotlin-gradle-plugin.md for the KGP wrappers.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.