Skip to content

Conversation

@ktoso
Copy link
Collaborator

@ktoso ktoso commented Jan 6, 2026

Added tests to the #502 and some cleanup

Will retain credit to @diederich ofc, thank you!

Java's `init` methods are bridged as is and made swift compatible
via the backticks.
At runtime though, this is forgotten and the java methods are looked up
_with_ the backticks.

This approach of fixing adds a `@JavaMethod("init")` annotation, which fixes
the issue.

(Though I'm not sure if this shouldn't be fixed in the generated macro code.
Open for suggestions!)
@ktoso ktoso force-pushed the bugfix/init-methods branch from dcdf4bb to a6ec455 Compare January 6, 2026 07:14
@diederich
Copy link
Contributor

Thanks @ktoso! 🙏
Is JavaKitMethodCalledInitTests.swift a leftover?

@ktoso
Copy link
Collaborator Author

ktoso commented Jan 7, 2026

Is JavaKitMethodCalledInitTests.swift a leftover?

It's a test I've added to see these actually working at runtime, but I've been battling test issues with the JVM teardown so the body moved to the mangling one... I'll finish this up tonight probably

@ktoso ktoso force-pushed the bugfix/init-methods branch from 319149a to afdfec2 Compare January 7, 2026 11:38
@ktoso ktoso force-pushed the bugfix/init-methods branch from afdfec2 to 64a5d99 Compare January 7, 2026 11:56
@ktoso ktoso merged commit 2886d64 into swiftlang:main Jan 7, 2026
49 checks passed
@ktoso ktoso deleted the bugfix/init-methods branch January 7, 2026 12:05
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.

2 participants