wrap-java: Import deprecated and requires-api annotations#587
Merged
ktoso merged 3 commits intoswiftlang:mainfrom Mar 6, 2026
Merged
wrap-java: Import deprecated and requires-api annotations#587ktoso merged 3 commits intoswiftlang:mainfrom
ktoso merged 3 commits intoswiftlang:mainfrom
Conversation
We now handle Java Deprecated and also Android's RequiresApi annotations and import them as availability annotations on Swift side. The Android availability requires at least Swift 6.3 resolves swiftlang#586
ktoso
commented
Mar 6, 2026
| var lines: [String] = [] | ||
| for attr in attributes { | ||
| if let (major, minor) = attr.minimumCompilerVersion { | ||
| lines.append("#if compiler(>=\(major).\(minor))") |
Collaborator
Author
There was a problem hiding this comment.
I think that's the right check we need
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We now handle Java Deprecated and also Android's RequiresApi annotations and import them as availability annotations on Swift side.
The Android availability requires at least Swift 6.3
resolves #586
Claude assisted boilerplate and tests; refactored a bit how we do ThreadSafe as well, there's a new enum for "known" java annotations
Methods end up as
need to do the compiler check since Android availability is only since 6.3.
@colemancda Would love to see https://github.com/PureSwift/Android/ re-generated with these :-)