conjure-java icon indicating copy to clipboard operation
conjure-java copied to clipboard

[do-not-merge] Generate reachability-metadata.json files for generated object types

Open mpritham opened this issue 8 months ago • 1 comments

Context

In order to use reflection in native executables created with Graal's native-image feature we need to provide the Graal compiler a listing of the types and methods we'd like to be accessible for reflection. This is exposed via reachability metadata files stored in META-INF/native-image/**/reachability-metadata.json files.

Before this PR

No reflection metadata is generated. Jackson is unable to deserialize Conjure object types.

After this PR

When creating the metadata files, instead of listing the methods accessed for reflection, we use the convenience functions allDeclaredFields, allPublicFields and allDeclaredConstructors.

==COMMIT_MSG== Generate reachability-metadata.json files for generated object types ==COMMIT_MSG==

Possible downsides?

We over-include certain methods: several methods in the Builder classes are convenience overrides and are not accessed via reflection by Jackson (e.g. addAllX methods for collections fields). This over-inclusion isn't preferred: 1) it'd be safer to enforce that only a certain fields are accessible via reflection to prohibit arbitrary uses of reflection, 2) including extra methods increases binary size. We are still in the early stages of exploring Java native executables and have opt'd to over-include methods accessible for reflection to iterate faster.

mpritham avatar Mar 03 '25 21:03 mpritham

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration, performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • [ ] Feature
  • [ ] Improvement
  • [ ] Fix
  • [ ] Break
  • [ ] Deprecation
  • [ ] Manual task
  • [ ] Migration

Description Generate reachability-metadata.json files for generated object types

Check the box to generate changelog(s)

  • [ ] Generate changelog entry

changelog-app[bot] avatar Mar 03 '25 21:03 changelog-app[bot]

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

stale[bot] avatar Jun 27 '25 04:06 stale[bot]