-
Notifications
You must be signed in to change notification settings - Fork 251
Description
Kotlin + Lombok mixed-mode compilation breaks (missing Lombok-generated methods)
Environment
-
Bazel: (add your version)
-
rules_kotlin: 1.9.x
-
rules_java: bundled
-
rules_jvm_external: (version)
-
Platform: macOS (dev), Linux (CI)
π¨ Summary of the Problem
Our project contains mixed Java + Kotlin source sets where:
-
Kotlin code calls Java classes
-
Java classes use Lombok, generating getters/setters
-
Java code also references Kotlin classes
This creates a circular dependency:
Kotlin β needs Lombok-generated Java methods Java β needs Kotlin classes Lombok β needs Java compilation before Kotlin
Under Maven/Gradle this works because Java + Kotlin + Lombok compile in a unified phase.
Under rules_kotlin, the Kotlin compiler sees the raw Java source before Lombok runs, causing missing symbol errors.
β Errors We Get
error: cannot find symbol sessionStorage.setUserId(...) ^ symbol: method setUserId(String) location: variable sessionStorage of type SessionStorage
But these methods are generated by Lombok β they should exist.
β What We Have Tried
Nothing resolves the core issue:
rules_kotlin does not support mixed Java + Kotlin compilation where annotation processors must run before Kotlin.
π§ͺ Minimal Reproduction
Java (with Lombok)
@Data public class SessionStorage { private String userId; }
Kotlin (uses Lombok-generated getter)
class PremiumClient(private val session: SessionStorage) { fun test() = session.userId // Fails: no getter found }
Java referencing Kotlin
public class AuthService { private final PremiumClient client = new PremiumClient(new SessionStorage()); }
π€ Expected Behavior
-
Lombok should generate getters/setters before Kotlin is compiled.
-
Kotlin should compile against bytecode, not the raw Java source.
-
Mixed Java/Kotlin source sets should be supported, like Gradle or Maven.
π₯ Actual Behavior
-
Kotlin compiler is invoked before Lombok-generated bytecode exists.
-
It cannot resolve methods that Lombok would generate.
-
Java compilation then fails because Kotlin compilation failed.
π― What We Are Requesting
1οΈβ£ Official Lombok support for mixed Java + Kotlin compilation
Something equivalent to:
-
Java annotation processing
-
Kotlin + Java compilation in a single step
-
kaptcompatibility or alternative
2οΈβ£ A unified compile action
Where:
-
Java annotation processors run first
-
Kotlin compiles against their bytecode
3οΈβ£ Documentation or recommended path
For projects migrating from Maven β Bazel that use:
-
Spring Boot
-
Lombok
-
Kotlin
-
Java legacy code
This combination is extremely common in enterprise projects.
π§© Why This Matters
Many real-world projects depend on:
-
Spring Boot
-
Lombok
-
Kotlin for new features
-
Java for legacy components
These mixed source sets are widely used and currently cannot compile in Bazel using rules_kotlin without major restructuring.
A unified solution would benefit many teams across the ecosystem.