swiftlang / swiftlang/swift-java
Java2Swift: nested types in generic types
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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