feat: @Jvm* annotations for Java interoperability (KOJAK-65)#24
Open
feat: @Jvm* annotations for Java interoperability (KOJAK-65)#24
Conversation
Add @JvmName, @jvmoverloads, and @JvmStatic annotations across core, HTTP, Kafka, and Spring Boot modules so Java consumers get a clean API. @JvmName — fix value class name mangling: - OutboxPublisher.publish(), TransactionalOutboxPublisher.publish(), SpringOutboxPublisher.publish() (OutboxId return type) - OutboxEntry.getOutboxId() (OutboxId property) @jvmoverloads — generate constructor/method overloads: - OutboxPublisher(OutboxStore), OutboxScheduler(OutboxProcessor), OutboxPurger(OutboxStore), HttpMessageDeliverer(ServiceUrlResolver), HttpDeliveryInfo, KafkaDeliveryInfo, OutboxProcessor.processNext() @JvmStatic — expose companion methods as static: - OutboxEntry.createPending(), OutboxStatus.from(), HttpDeliveryInfo.deserialize(), KafkaDeliveryInfo.deserialize()
Collaborator
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. Review scope: 7 parallel agents reviewed the PR from different angles:
Known limitation (accepted): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@JvmNameto fix value class name mangling onpublish()andgetOutboxId()— without these, the methods are uncallable from Java (Kotlin inserts a dash in the method name)@JvmOverloadson 7 constructors/methods to generate overloads with Kotlin default parameters visible from Java@JvmStaticon 4 companion object methods so Java callers don't need.Companion.15 annotations across 11 files, 4 modules (core, http, kafka, spring-boot). No logic changes.
Validated with a standalone Java 21 project (
okapi-java-interop-example) that exercises all Okapi layers from pure Java — before and after annotations.Test plan
./gradlew test— all unit and integration tests pass./gradlew ktlintFormat— formatting cleanjavap—publish(),getOutboxId(),createPending()all have correct (non-mangled) names