Skip to content

jextract: pass arena from Swift instead of default interface for callbacks#489

Merged
ktoso merged 5 commits into
swiftlang:mainfrom
madsodgaard:change-procol-defaults
Dec 10, 2025
Merged

jextract: pass arena from Swift instead of default interface for callbacks#489
ktoso merged 5 commits into
swiftlang:mainfrom
madsodgaard:change-procol-defaults

Conversation

@madsodgaard
Copy link
Copy Markdown
Contributor

Previously, we generated default methods for the Java interface methods that require a SwiftArena. That was a way to basically use a global arena, instead of passing in one from Swift.

I think this PR is a better solution, where we pass in the global arena from Swift (a global cached ref) and not generate the default methods, unless the user has explicitly requested it through the allowGlobalArena memory management mode.

Copy link
Copy Markdown
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Let's clean this up some more while at it, goal looks good tho

Comment thread Sources/SwiftJavaRuntimeSupport/JNI.swift
Comment thread Sources/SwiftJavaRuntimeSupport/JNI.swift Outdated
Comment thread Sources/SwiftJavaRuntimeSupport/generated/JavaSwiftArena.swift
Comment thread Sources/SwiftJavaRuntimeSupport/JNI.swift Outdated
Comment thread Sources/SwiftJava/AnyJavaObject.swift Outdated
@ktoso ktoso merged commit acff3ee into swiftlang:main Dec 10, 2025
48 checks passed
@madsodgaard madsodgaard deleted the change-procol-defaults branch December 11, 2025 08:51
ktoso added a commit to ktoso/swift-java that referenced this pull request Dec 19, 2025
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