swiftlang / swiftlang/swift-java

Java2Swift: nested types in generic types

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

Nobody has claimed this yet.

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

Description

For example trying to import guava 'com.google.guava:guava:33.3.1-jre' results in:

/Users/ktoso/code/swift-java/Samples/JavaDependencySampleApp/.build/plugins/outputs/javadependencysampleapp/JavaGuava/destination/Java2SwiftPlugin/generated/ImmutableList+Builder.swift:7:63: error: reference to generic type 'ImmutableList<E>.SubList.Builder' requires arguments in <...>
 5 | extension ImmutableList {
 6 |   @JavaClass("com.google.common.collect.ImmutableList$Builder")
 7 |   open class Builder<E: AnyJavaObject>: ImmutableList.SubList.Builder {
   |                                                               `- error: reference to generic type 'ImmutableList<E>.SubList.Builder' requires arguments in <...>
 8 |   @JavaMethod
 9 |   @_nonoverride public convenience init(environment: JNIEnvironment? = nil)

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

Reproduce the failure by importing guava 33.3.1-jre in Samples/JavaDependencySampleApp and inspect the generated ImmutableList+Builder.swift file under the Java2SwiftPlugin output. Trace how Java2Swift represents nested types inside generic types; the work is done when the generated Guava bindings compile without the reported generic-argument error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.