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

read safety of external types

Open lsingh123 opened this issue 2 years ago • 3 comments

This PR follows up https://github.com/palantir/conjure/pull/1315 to support log safety annotations for external imports, declared at import time.

lsingh123 avatar Feb 02 '23 21:02 lsingh123

Generate changelog in changelog/@unreleased

Type

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

Description The generator now supports log safety annotations on external imports, declared at import time.

Check the box to generate changelog(s)

  • [x] Generate changelog entry

changelog-app[bot] avatar Feb 02 '23 21:02 changelog-app[bot]

Could you update example-types.yml to take advantage of this, and regenerate the integrationInput sources using ./gradlew test -Drecreate=true?

Separately (potentially as a separate PR from this one as it may become a little more involved):

I think as written, this will update generated types which contain external imports to reflect the safety of those types, however we probably also want to annotate some of the getter and setter fields with safety annotations since the imported type itself isn't annotated (java.lang.Long doesn't have a safe or unsafe annotation). This way, if we alias a safe external long import, the alias factory method becomes public static MyAlias of(@Safe long value), so that unsafe data cannot be passed in.

carterkozak avatar Feb 03 '23 15:02 carterkozak

That sounds like a plan - I'll open a separate PR for that change.

lsingh123 avatar Feb 03 '23 17:02 lsingh123