swiftlang / swiftlang/swift-java

Consider @JExtract swift attribute to control jextract behavior

Open
#335 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature:jextract
Dominant language
Swift
Stars
1.2k
Forks
123
Avg merge
1d 7h
Merged PRs (30d)
16

Description

Some behaviors of jextract may be useful to configure on a decl by decl basis.

For example, we might want to say JExtract(as: .javaLong) var int: UInt32 which would then apply the "widen" conversion when extracting this integer to a getter/setter in Java (void setInt(long value)) in order to support the unsigned positive range of those numbers.

This has the downside of having to modify the Swift sources but may be nice for some developers.

The same attribute should be usable for other extract behavior changes like renaming etc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the jextract implementation and its handling of Swift declarations and extraction behavior. Determine how an @JExtract attribute could configure widening and renaming on individual declarations, then define tests showing those options affect the generated Java API.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.