Skip to content

Commit 02aa93f

Browse files
Replace Moshi with Micronaut Serde in SDK patches
Rewrites patch 0001 (Jackson -> Micronaut Serde 3.x): user payloads use the application's injected io.micronaut.serde.ObjectMapper; SDK-internal protocol JSON (operation tokens, local-activity markers, failure encoding) uses a library-private mapper whose SDK-specific formats (Duration-as-millis, OperationTokenType-as-int) are field-scoped and proven not to leak into a consuming app's DI mapper. Removes jackson-databind and moshi from the runtime classpath (okio remains as a wire-runtime transitive). The Serde 3.x requirement bumps the build to JDK 25 / Gradle 9 (wrapper 9.x, --release 25, Mockito 5.23.0, logback 1.5.18, Error Prone disabled on the 25 modules). Trims patch 0004 (Wire) to drop the Moshi WireJsonAdapterFactory integration; Wire Message types serialize as native protobuf binary. overlay/gradle.properties: drop moshiVersion, add Serde/Micronaut versions + build heap. README: rebuilt patch table, Serde behavior notes. CI: JDK 25. Note: .github/workflows/manual-build.yml also carries a pre-existing uncommitted version_override input (unrelated working-tree edit). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent bcc36b3 commit 02aa93f

9 files changed

Lines changed: 3159 additions & 2102 deletions

.github/workflows/manual-build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on:
1717
required: false
1818
type: boolean
1919
default: false
20+
version_override:
21+
description: 'Override computed version (e.g., 1.35.0-pkware.1). Leave empty for auto.'
22+
required: false
23+
type: string
24+
default: false
2025

2126
permissions: {}
2227

@@ -41,7 +46,7 @@ jobs:
4146
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
4247
with:
4348
distribution: 'temurin'
44-
java-version: '21'
49+
java-version: '25'
4550

4651
- name: Build and test
4752
working-directory: build

.github/workflows/sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
6666
with:
6767
distribution: 'temurin'
68-
java-version: '21'
68+
java-version: '25'
6969

7070
- name: Build and test
7171
if: steps.detect.outputs.should_sync == 'true'

README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,39 @@ Patch-based fork of [temporalio/sdk-java](https://github.com/temporalio/sdk-java
66

77
| Patch | Description |
88
|-------|-------------|
9-
| 0001 | Replace Jackson with Moshi as default JSON converter |
10-
| 0002 | Remove GSON dependency |
11-
| 0003 | Replace grpc-netty-shaded with grpc-netty (real, un-shaded) |
12-
| 0004 | Change groupId to `com.pkware.temporal` |
9+
| 0001 | Replace Jackson with Micronaut Serde as default JSON converter (also bumps the build to JDK 25 / Gradle 9) |
10+
| 0002 | Replace grpc-netty-shaded with grpc-netty (real, un-shaded) |
11+
| 0003 | Change groupId to `com.pkware.temporal` |
12+
| 0004 | Add Wire protobuf support |
13+
14+
## Serialization: Micronaut Serde
15+
16+
The default `json/plain` `PayloadConverter` is `io.temporal.common.converter.MicronautSerdePayloadConverter`,
17+
backed by Micronaut Serde (Jackson 3 streaming + `jackson-annotations`, **no `jackson-databind`**). In
18+
production, construct the data converter with your application's injected `io.micronaut.serde.ObjectMapper`:
19+
20+
```java
21+
DataConverter converter =
22+
DefaultDataConverter.newDefaultInstance()
23+
.withPayloadConverterOverrides(new MicronautSerdePayloadConverter(appObjectMapper));
24+
```
25+
26+
The no-arg constructor falls back to a library-private mapper (used by SDK defaults and tests).
27+
28+
**Behavior differences from the previous Jackson/Moshi converter** (Serde is reflection-free / compile-time):
29+
30+
- Workflow argument/result types must be `@io.micronaut.serde.annotation.Serdeable` (your Micronaut 5 models already are).
31+
- **Public-field POJOs serialize to `{}`** — Serde uses getter/property access by default. Use records, getters, or `@Introspected(accessKind = {FIELD, METHOD})`.
32+
- `java.time.Duration` serializes as integer nanoseconds (Serde default), not an ISO-8601 string.
33+
- An empty `byte[]` field inside a large bean may deserialize as `null`.
34+
- Wire `com.squareup.wire.Message` types serialize as native protobuf binary (`protobuf/wire`); the previous nested-Wire-in-JSON (Moshi `WireJsonAdapterFactory`) path is gone.
1335

1436
## Maven coordinates
1537

1638
```kotlin
1739
// build.gradle.kts
18-
implementation("com.pkware.temporal:temporal-sdk:1.35.0-pkware.1")
19-
testImplementation("com.pkware.temporal:temporal-testing:1.35.0-pkware.1")
40+
implementation("com.pkware.temporal:temporal-sdk:1.36.0-pkware.1")
41+
testImplementation("com.pkware.temporal:temporal-testing:1.36.0-pkware.1")
2042
```
2143

2244
## Version scheme
@@ -45,20 +67,20 @@ cd build
4567
./gradlew test
4668
```
4769

48-
Requires JDK 21.
70+
Requires **JDK 25** (Micronaut Serde 3.x requires JVM 17+; the build targets `--release 25`). The Gradle wrapper is 9.x, which runs natively on JDK 25.
4971

5072
### Publishing locally
5173

5274
```bash
5375
cd build
54-
./gradlew publishToMavenLocal -PoverrideVersion=1.35.0-pkware.1
76+
./gradlew publishToMavenLocal -PoverrideVersion=1.36.0-pkware.1
5577
```
5678

5779
Then add `mavenLocal()` to your consuming project's repositories block.
5880

5981
## Dependency versions
6082

61-
New dependencies introduced by patches (e.g. Moshi) have their versions in `overlay/gradle.properties`. This file is copied into `build/` by `apply-patches.sh` and is scannable by Renovate.
83+
New dependencies introduced by patches (Micronaut Serde, Wire) have their versions in `overlay/gradle.properties` (`micronautSerdeVersion`, `micronautVersion`, `wireVersion`), along with the Gradle heap settings the JDK-25 build needs. This file is copied into `build/` by `apply-patches.sh` and is scannable by Renovate. Versions bumped on existing dependencies (Mockito, logback, Error Prone) live in the patched `build.gradle` itself.
6284

6385
## Modifying patches
6486

overlay/gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
moshiVersion=1.15.2
21
wireVersion=6.4.0
2+
micronautSerdeVersion=3.0.0
3+
micronautVersion=5.0.0
4+
# JDK 25 + Gradle 9 + Micronaut Serde codegen need more heap than Gradle's 512MB default;
5+
# the full parallel test suite OOMs otherwise.
6+
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=768m

0 commit comments

Comments
 (0)