swiftlang / swiftlang/swift-java

Create a runtime mapping from Java canonical class names to their equivalent Swift types

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When we have a Swift type that wraps a Java class, it has a macro annotation like this:

@JavaClass("java.lang.Object")
struct JavaObject { ... }

Given the type JavaObject on the Swift side, we can query the AnyJavaObject conformance to get the canonical Java class name. However, we have no way to go in the opposite direction, from a Java class name like java.lang.Object to JavaObject. The translation manifest has this information for use in the tool, but at runtime there is no way say "find the most specific Swift type for this Java object".

We should consider some kind of automatically-populated runtime registry to make this possible.

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 with Sources/JavaKit/AnyJavaObject.swift and Sources/Java2Swift/TranslationManifest.swift to compare the existing canonical-name information with the proposed runtime lookup. Investigate how a runtime registry could be populated and queried, and define completion as resolving a Java canonical class name to its most specific Swift type.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, swift
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.