Skip to content

Add regression coverage for overloaded initializer Java names#781

Open
tiennguyen2310 wants to merge 2 commits into
swiftlang:mainfrom
tiennguyen2310:fix-issue-425
Open

Add regression coverage for overloaded initializer Java names#781
tiennguyen2310 wants to merge 2 commits into
swiftlang:mainfrom
tiennguyen2310:fix-issue-425

Conversation

@tiennguyen2310

Copy link
Copy Markdown

Adds regression coverage for #425.
This covers the reported initializer-collision where distinct Swift initializers could otherwise produce duplicate Java init(...) signatures. The added tests assert that the generated FFM/JNI Java names are disambiguated, e.g. initThrowing and initDoInit, and that the raw duplicate init(...) signatures are absent.

Closes #425.

Test:

  • swift test --filter MethodImportTests

@tiennguyen2310 tiennguyen2310 requested a review from ktoso as a code owner June 8, 2026 10:10
public init(throwing: Swift.Bool) throws
public init(doInit: Swift.Bool)
}
"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No real reason for two separate input strings

"public static OverloadedInitializerClass init(boolean throwing, SwiftArena swiftArena)",
"public static java.util.Optional<OverloadedInitializerClass> init(boolean doInit, SwiftArena swiftArena)",
]
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it one test that is parameterized over the two modes please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[jextract] Handle ambiguous Swift methods not possible in Java

2 participants