Skip to content

Commit 25be9dc

Browse files
michalharakalclaude
andcommitted
Annotate StableHloConverterFactory for Java call sites (#400)
Adds `@JvmStatic` to every factory method on the `StableHloConverterFactory` object (`createBasic`, `createExtended`, `createFast`, `createCustom`) plus `@JvmOverloads` on `createCustom` so every parameter default generates a separate JVM overload. Before: Java call sites had to go through the Kotlin singleton marker: var converter = StableHloConverterFactory.INSTANCE.createExtended(); After: Java callers can use the idiomatic static form: var converter = StableHloConverterFactory.createExtended(); The `@JvmStatic` annotation lives in `commonMain` — Kotlin 1.9+ accepts JVM-specific annotations in common code and treats them as no-ops on non-JVM targets. Verified across all Kotlin Multiplatform targets (jvmTest, wasmJsTest, wasmJsBrowserTest, wasmWasiTest, wasmWasiNodeTest, macosArm64Test, iosSimulatorArm64Test) — zero regressions. Second of five commits polishing the Java / JVM consumption story for the upcoming 0.19.0 release. See #400. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1253b42 commit 25be9dc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

skainet-compile/skainet-compile-hlo/src/commonMain/kotlin/sk/ainet/compile/hlo/StableHloConverterFactory.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import sk.ainet.compile.hlo.converters.MathOperationsConverter
99
import sk.ainet.compile.hlo.converters.NeuralNetOperationsConverter
1010
import sk.ainet.compile.hlo.converters.ReductionOperationsConverter
1111
import sk.ainet.compile.hlo.converters.ShapeOperationsConverter
12+
import kotlin.jvm.JvmStatic
1213

1314
/**
1415
* Factory for creating StableHLO converters with default configurations.
@@ -21,6 +22,7 @@ public object StableHloConverterFactory {
2122
/**
2223
* Create a converter with basic operations support (add, matmul, relu)
2324
*/
25+
@JvmStatic
2426
public fun createBasic(): StableHloConverter {
2527
val registry = StableHloOperationRegistry()
2628
val typeMapper = TypeMapper()
@@ -57,6 +59,7 @@ public object StableHloConverterFactory {
5759
/**
5860
* Create a converter with extended operations support
5961
*/
62+
@JvmStatic
6063
public fun createExtended(): StableHloConverter {
6164
val registry = StableHloOperationRegistry()
6265
val typeMapper = TypeMapper()
@@ -96,6 +99,7 @@ public object StableHloConverterFactory {
9699
/**
97100
* Create a converter without validation (for performance)
98101
*/
102+
@JvmStatic
99103
public fun createFast(): StableHloConverter {
100104
val registry = StableHloOperationRegistry()
101105
val typeMapper = TypeMapper()
@@ -115,6 +119,8 @@ public object StableHloConverterFactory {
115119
/**
116120
* Create a custom converter with the provided components
117121
*/
122+
@JvmStatic
123+
@kotlin.jvm.JvmOverloads
118124
public fun createCustom(
119125
registry: StableHloOperationRegistry,
120126
typeMapper: TypeMapper = TypeMapper(),

0 commit comments

Comments
 (0)