Skip to content

Add Java generation for native Nexus APIs - #245

Draft
tconley1428 wants to merge 15 commits into
mainfrom
java-signal-with-start
Draft

tconley1428 wants to merge 15 commits into
mainfrom
java-signal-with-start

Conversation

@tconley1428

@tconley1428 tconley1428 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Java generation handles native Nexus declarations and protobuf transfer types, enabling workflow-side signal-with-start in the Java SDK. It emits models, builders, operations, resources, variants, generics, outbound interceptor hooks, serialization-context factories, and an operation-root manifest for SDK payload visitor generation. An inheritable operations class exposes generated APIs without handwritten facade methods. Java formatting landed separately in #246.

Operation parameters contain only function references/names and their inputs. All other fields, including required fields, belong to a mandatory generated options object. Typed overloads support primary callable arities zero through six and other callable arities zero or one, preserving argument and result types for value-returning and void methods. Name-based calls accept an Object[] after each callable name. Shared private invocation/request helpers avoid duplicating validation, extraction, and merging across overloads.

Java-only @nexus.merge-from-function function="workflow" java="..." annotations select helpers that merge callable metadata with explicit options. Existing parser/model mappings retain the helper reference and metadata type without a new compiler pass. Required fields with merge hooks may be omitted from Java options and are validated after resolution at invocation; wire-model requiredness is unchanged. Other languages ignore these Java hooks.

The shared workflow-service WIT uses these hooks for workflow ID and retry/cron annotations. Typed calls derive ID from the workflow reference, reject conflicting explicit IDs and run-pinned references, and ignore the signal reference's execution identity. Untyped calls require an explicit ID. Task queue remains required. Helpers own these policies; generation has no workflow/start/signal-specific branches or synthesized WorkflowOptions.

Protobuf conversion uses the existing descriptor index and SDK-owned converter scope for embedded user values. Required payload fields serialize null values; optional null fields remain absent. Conversion helpers reuse SDK utilities where available. The sample support helper contains its own implementation, matching the package-private SDK helper rather than delegating to it. Runtime helpers are emitted Rust strings. JSON Schema orchestration remains in its Java submodule. Shared WIT and temporary SDK copies are byte-identical.

Signal-with-start serializes its request and receives a payload-free response. Future payload responses need generic models and concrete result types. The known packing-codec limitation in request-model deserialization remains outside this call path.

Validation for the latest changes: nine generator tests, Java samples including 51 compiler cases, 18 focused companion SDK tests, and two real-server signing-codec/replay tests passed. Compiler cases cover arity/type/result errors, nested generics, void methods, mandatory options, and untyped fallback. Full cross-language validation passed on earlier revisions; it was not rerun for these latest changes, per the requested iteration scope.

Companion SDK draft: temporalio/sdk-java#3154. Java samples use TEMPORAL_JAVA_SDK_DIR for unreleased SDK integration.

@tconley1428
tconley1428 force-pushed the java-signal-with-start branch from 84f3d95 to 24428c3 Compare October 20, 2026 16:02
@tconley1428
tconley1428 changed the base branch from main to java-output-format October 20, 2026 16:02
@tconley1428
tconley1428 added this pull request to stack #247 October 20, 2026 16:02
@tconley1428
tconley1428 force-pushed the java-signal-with-start branch from c955956 to 0fb0f6a Compare October 22, 2026 17:11
Base automatically changed from java-output-format to main October 22, 2026 17:30
@tconley1428
tconley1428 force-pushed the java-signal-with-start branch from 0fb0f6a to 3b7e603 Compare October 22, 2026 17:30
@tconley1428
tconley1428 force-pushed the java-signal-with-start branch from 3b7e603 to 00090da Compare October 26, 2026 19:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant