swiftlang / swiftlang/swift-java

wrap-java: Generated @JavaInterfaces must have JavaObject base functions

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

Nobody has claimed this yet.

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

Description

The way we're generating Swift types for interfaces is problematic:

@JavaInterface("java.lang.reflect.TypeVariable", extends: Type.self)
public struct TypeVariable<D: AnyJavaObject> {
  @JavaMethod
  public func getGenericDeclaration() -> GenericDeclaration!
  
  @JavaMethod
  public func getAnnotatedBounds() -> [AnnotatedType?]

while we know we can call hashCode, equals and toString on those types... Lack of those on extracted types means we can't make ALL java types Hashable, which makes interfaces hard to work with -- and since a lot of java is interface based, that's not ideal.

It also makes our description->toString problematic.

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 in the wrap-java generation path responsible for Swift interface types such as TypeVariable. Trace how generated interfaces represent JavaObject behavior and determine how hashCode, equals, and toString should be exposed; done means generated interfaces provide those base functions and support the intended Hashable use.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, swift
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.