Skip to content

Update IC4J dependencies and harden code generation - #1

Merged
rdobrik merged 5 commits into
masterfrom
rdobrik-update-ic4j-versions
Sep 11, 2026
Merged

rdobrik merged 5 commits into
masterfrom
rdobrik-update-ic4j-versions

Conversation

@rdobrik

@rdobrik rdobrik commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Why

The code generator needed to consume the local IC4J agent and Candid 0.8.5 artifacts, while several generation paths could emit incomplete or uncompilable clients without failing the build.

What changed

  • Update the project, agent, and Candid versions to 0.8.5 and align JBang metadata.
  • Correct Java, Spring, and React Native generation for writer options, update/query/oneway dispatch, optional responses, Spring construction, and Java-safe collision-aware identifiers.
  • Validate CLI identity settings consistently, preserve anonymous defaults, close transport and reader resources, and make JAXB failures observable.
  • Build the fat JAR from runtime dependencies with deterministic duplicate handling.
  • Add tracked Maven publication metadata with correct API dependency scopes.
  • Add regression tests, compile generated sources as part of check, and add a Java 8/11/21 CI workflow.

Validation

  • ./gradlew check fatJar publishToMavenLocal
  • 13 tests pass.
  • Generated Java, Spring, and React Native sources compile.
  • The executable fat JAR and Maven 0.8.5 artifacts are produced successfully.

Update IC4J agent and Candid dependencies to 0.8.5, correct generated Java, Spring, and React Native behavior, harden CLI and JAXB error handling, and add reproducible packaging and regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 11, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical generation and packaging issues, along with moderate correctness concerns, block approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates IC4J Codegen to 0.8.5 while hardening client generation, JAXB handling, packaging, publication, testing, and CI.

Changes:

  • Updates dependencies, JBang metadata, publishing, and fat-JAR configuration.
  • Improves Java, Spring, React Native, identity, and JAXB generation.
  • Adds regression tests, generated-source checks, and Java 8/11/21 CI.
File summaries
File Reviewed changes and findings
src/test/java/org/ic4j/codegen/test/XSDWriterTest.java Generation failures now fail the test.
src/test/java/org/ic4j/codegen/test/SwiftTest.java Generation failures now fail the test.
src/test/java/org/ic4j/codegen/test/RosettaNetTest.java Generation failures now fail the test.
src/test/java/org/ic4j/codegen/test/JAXBWriterTest.java Generation failures now fail the test.
src/test/java/org/ic4j/codegen/GeneratorRegressionTest.java Adds generator regression coverage.
src/main/java/org/ic4j/codegen/SpringWriter.java Improves Spring generation. Critical findings: raw proxy names, lifecycle init collisions, and invalid @Async usage remain possible.
src/main/java/org/ic4j/codegen/ReactNativeWriter.java Improves React Native dispatch and response generation.
src/main/java/org/ic4j/codegen/JAXBGenerator.java Adds failure propagation, XML hardening, and timeouts. Moderate finding: interrupted writers may continue running.
src/main/java/org/ic4j/codegen/JavaxJAXBGenerator.java Improves JAXB error handling.
src/main/java/org/ic4j/codegen/JavaWriterContext.java Tracks collision-aware generated type names.
src/main/java/org/ic4j/codegen/JavaWriter.java Improves Java generation. Critical finding: Object method signatures are not reserved.
src/main/java/org/ic4j/codegen/JavaIdentifier.java Adds identifier normalization. Critical finding: Object-final method names such as getClass are not reserved.
src/main/java/org/ic4j/codegen/JakartaJAXBGenerator.java Improves JAXB error handling.
src/main/java/org/ic4j/codegen/IC4JBase.java Validates identities and closes resources.
src/main/java/org/ic4j/codegen/IC4J.java Improves CLI metadata and usage handling.
src/main/java/org/ic4j/codegen/CodegenException.java Adds cause-aware exceptions.
README.md Updates dependency version examples.
jbang/IC4JJBang.java Updates JBang dependencies.
DEPLOY.md Updates publishing instructions. Nit: dry-run validation does not verify remote credentials or repositories.
build.gradle Configures dependencies, publication, fat JAR, and generated-source checks. Critical finding: the fat JAR omits compile-only React Native dependencies. Moderate finding: generation relies on an undeclared test side effect.
.gitignore Stops ignoring tracked publishing configuration.
.github/workflows/build.yml Adds Java 8/11/21 CI validation.
Review details

Suppressed comments (3)

DEPLOY.md:43

  • This command only performs a local publication task, and Gradle --dry-run skips task actions, so it cannot validate the remote release repository or credentials as the preceding text claims. Keep this as a task-graph check with accurate wording, or document a separate remote publication task/configuration for credential validation.
./gradlew --no-daemon publishToMavenLocal --dry-run --console=plain

src/main/java/org/ic4j/codegen/JAXBGenerator.java:164

  • Cancelling with interruption and immediately calling shutdownNow() does not guarantee that the TypeWriter task has stopped; TypeWriter.writeFile has no interruption contract, so a writer can continue traversing and writing after this timeout is reported. Repeated timeouts can leave daemon workers alive and can race with later generations or leave partial output. Use an isolation/termination mechanism, or wait for guaranteed worker termination before reporting the timeout.
				future.cancel(true);

src/main/java/org/ic4j/codegen/SpringWriter.java:172

  • When useFuture is false, toTypeName(..., isFuture) produces a plain response type, but the response branch still adds @Async solely because isFuture is true. That generates methods such as @Async String update(...), which Spring rejects at runtime because asynchronous methods must return void or a Future; gate this annotation on this.useFuture as well.
					methodBuilder.addStatement("return this.call($S" + args + ")",name);
  • Files reviewed: 20/22 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/org/ic4j/codegen/JavaIdentifier.java
Comment thread src/main/java/org/ic4j/codegen/JavaWriter.java
Comment thread src/main/java/org/ic4j/codegen/SpringWriter.java
Comment thread src/main/java/org/ic4j/codegen/SpringWriter.java Outdated
@rdobrik

rdobrik commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the suggestion exactly.

Do not make changes beyond what is described in the linked review thread.

Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the ...

Addressed in c63ce1c.

Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>
rdobrik and others added 2 commits September 11, 2026 16:18
Reserve final Object method names, prevent Spring lifecycle collisions, normalize generated proxy references, package compile-only runtime classes, make generated-source task outputs explicit, and remove unsafe timeout workers.

Keep local-only IC4J 0.8.5 dependencies while removing the hosted workflow that cannot resolve them from Maven Central.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Choose a lifecycle method name outside the generated proxy method set and keep the regression tests compatible with the Java 8 target.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rdobrik
rdobrik merged commit a6eff51 into master Sep 11, 2026
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.

3 participants