Skip to content

fix(be:#2467): add GraalVM reflection metadata for zjsonpatch Jackson 3 - #2468

Merged
mamartinezmejia merged 6 commits into
mainfrom
fix/be/2467-egacy-zjsonpatch-native-reflection
Sep 9, 2026
Merged

fix(be:#2467): add GraalVM reflection metadata for zjsonpatch Jackson 3#2468
mamartinezmejia merged 6 commits into
mainfrom
fix/be/2467-egacy-zjsonpatch-native-reflection

Conversation

@mamartinezmejia

@mamartinezmejia mamartinezmejia commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Task Summary

Add GraalVM native-image reflection metadata for zjsonpatch's Jackson 3 bridge classes, fixing status updates (e.g. changing a client's status to DECEASED) that fail when the legacy module runs as a native image. Fixes issue #2467.


Background

Client status changes are applied as a JSON Patch via zjsonpatch. Since the earlier Jackson 2 → Jackson 3 migration (PR #2446), zjsonpatch uses its Jackson 3 bridge classes (Jackson3ObjectNodeWrapper, Jackson3ArrayNodeWrapper, Jackson3NodeWrapper, Jackson3NodeFactory) and Jackson 3's JsonNode/ObjectNode/ArrayNode types, all of which rely on reflection to construct and invoke methods at runtime. GraalVM native image strips unused reflective access by default unless it's explicitly declared, so without a reflect-config.json, these classes fail to be constructed/invoked correctly in the compiled native image — surfacing to users as an inability to save a status change.


Task Details

1. legacy/src/main/resources/META-INF/native-image/reflect-config.json

Add a new GraalVM reflection configuration file registering full reflective access (allDeclaredConstructors, allPublicConstructors, allDeclaredMethods, allPublicMethods) for the four zjsonpatch Jackson 3 bridge classes, plus declared constructor/method access for Jackson 3's tools.jackson.databind.JsonNode, ObjectNode, and ArrayNode.

2. legacy/pom.xml

Add a <resource> entry to the build resources configuration to explicitly include META-INF/** from src/main/resources, ensuring the new reflect-config.json (and any other META-INF native-image metadata) is picked up and packaged during the build.

3. Verification

  • Build the legacy module as a native image and confirm META-INF/native-image/reflect-config.json is present on the classpath/in the packaged artifact.
  • Reproduce the original bug (client 00116026 as ADMIN → Edit Client → change status → Save) against the native image and confirm the status change now saves successfully.
  • Confirm no other JSON Patch operations (status or otherwise) regress under native image.

Acceptance Criteria

  • reflect-config.json registers the required zjsonpatch Jackson 3 bridge classes and Jackson 3 node types
  • legacy/pom.xml correctly packages META-INF/** resources into the build output
  • Changing a client's status (including to DECEASED) succeeds when running as a native image
  • No regressions in other status-change/JSON Patch flows

Notes


Thanks for the PR!

Deployments, as required, will be available below:
Any successful deployments (not always required) will be available here

Please create PRs in draft mode. Mark as ready to enable:

After merge, new images are deployed in:

- Add reflect-config.json for zjsonpatch Jackson 3 bridge classes and Jackson databind node types
- Include META-INF resources in legacy pom.xml build resources configuration
Copilot AI lite review requested due to automatic review settings September 9, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are small, targeted, and primarily add build/runtime metadata needed for native-image compatibility, with only minor optional config tightening suggested.

Pull request overview

Adds GraalVM native-image reflection metadata for the legacy module to support zjsonpatch’s Jackson 3 integration and ensures the native-image config is packaged as a resource during the Maven build.

Changes:

  • Added META-INF/native-image/reflect-config.json entries for com.flipkart.zjsonpatch.mapping.jackson3.* and related Jackson node classes.
  • Updated legacy/pom.xml resources configuration to include META-INF/** without filtering so GraalVM config files are copied into the build output.
File summaries
File Description
legacy/src/main/resources/META-INF/native-image/reflect-config.json Adds reflection registration for zjsonpatch Jackson 3 wrappers and Jackson node types for native builds.
legacy/pom.xml Ensures META-INF/native-image/** resources are included (unfiltered) in the legacy build output.
Review details

Suppressed comments (3)

legacy/src/main/resources/META-INF/native-image/reflect-config.json:14

  • Same redundancy here: allPublicConstructors/allPublicMethods add no value when allDeclaredConstructors/allDeclaredMethods are enabled, and they broaden the reflection surface unnecessarily.
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true

legacy/src/main/resources/META-INF/native-image/reflect-config.json:21

  • Same redundancy here: consider removing the allPublic* flags since allDeclared* already covers them.
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true

legacy/src/main/resources/META-INF/native-image/reflect-config.json:28

  • Same redundancy here: allPublicConstructors/allPublicMethods are unnecessary given the allDeclared* settings, and trimming them keeps the reflection config smaller and clearer.
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • 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 legacy/src/main/resources/META-INF/native-image/reflect-config.json
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

There is no coverage information present for the Files changed

- Add reflect-config.json for zjsonpatch Jackson 3 bridge classes and Jackson databind node types
- Include META-INF resources in legacy pom.xml build resources configuration
@mamartinezmejia
mamartinezmejia force-pushed the fix/be/2467-egacy-zjsonpatch-native-reflection branch from 58cf974 to 300b31d Compare September 9, 2026 19:50
…s://github.com/bcgov/nr-forest-client into fix/be/2467-egacy-zjsonpatch-native-reflection

# Conflicts:
#	legacy/src/main/resources/META-INF/native-image/reflect-config.json
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

There is no coverage information present for the Files changed

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

There is no coverage information present for the Files changed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The added reflection config does not currently match the PR’s stated acceptance criteria for “full reflective access” on the zjsonpatch Jackson 3 bridge classes.

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

Review details

Suppressed comments (3)

legacy/src/main/resources/META-INF/native-image/reflect-config.json:11

  • PR description/acceptance criteria calls for full reflective access on zjsonpatch Jackson 3 bridge classes (declared + public constructors/methods), but this entry only enables the declared flags. Either update the metadata to include the public flags as well or adjust the PR description/AC to match what’s actually required.
  {
    "name": "com.flipkart.zjsonpatch.mapping.jackson3.Jackson3ArrayNodeWrapper",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },

legacy/src/main/resources/META-INF/native-image/reflect-config.json:16

  • PR description/acceptance criteria calls for full reflective access on zjsonpatch Jackson 3 bridge classes (declared + public constructors/methods), but this entry only enables the declared flags. Either update the metadata to include the public flags as well or adjust the PR description/AC to match what’s actually required.
  {
    "name": "com.flipkart.zjsonpatch.mapping.jackson3.Jackson3NodeWrapper",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },

legacy/src/main/resources/META-INF/native-image/reflect-config.json:21

  • PR description/acceptance criteria calls for full reflective access on zjsonpatch Jackson 3 bridge classes (declared + public constructors/methods), but this entry only enables the declared flags. Either update the metadata to include the public flags as well or adjust the PR description/AC to match what’s actually required.
  {
    "name": "com.flipkart.zjsonpatch.mapping.jackson3.Jackson3NodeFactory",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread legacy/src/main/resources/META-INF/native-image/reflect-config.json
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

There is no coverage information present for the Files changed

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

There is no coverage information present for the Files changed

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

There is no coverage information present for the Files changed

@mamartinezmejia
mamartinezmejia merged commit b6d8907 into main Sep 9, 2026
36 checks passed
@mamartinezmejia
mamartinezmejia deleted the fix/be/2467-egacy-zjsonpatch-native-reflection branch September 9, 2026 22:25
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.

4 participants