Repository navigation
Do not emit NS_SWIFT_UNAVAILABLE on @Throws interface methods. - #2902
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_1009085524
branch
2 times, most recently
from
October 29, 2026 18:58
a3ca760 to
47aba76
Compare
Allow Swift callers to call `@Throws` methods on Java interfaces (`@protocol`). - J2ObjC does not generate `(NSError **)error` adapter methods on `@protocol` declarations. - Previously, `TypeDeclarationGenerator` still marked `@Throws` interface methods as `NS_SWIFT_UNAVAILABLE` and skipped `NS_SWIFT_NAME`. Because no throwing replacement existed on the `@protocol`, Swift callers could not call these methods on interface references at all. - Now, `TypeDeclarationGenerator` only emits `NS_SWIFT_UNAVAILABLE` on non-interface `@Throws` methods, keeping interface methods callable in Swift with their `NS_SWIFT_NAME` annotation. PiperOrigin-RevId: 1009908926
copybara-service
Bot
force-pushed
the
test_1009085524
branch
from
October 29, 2026 20:14
47aba76 to
9f39113
Compare
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.
Do not emit NS_SWIFT_UNAVAILABLE on @throws interface methods.
Allow Swift callers to call
@Throwsmethods on Java interfaces (@protocol).(NSError **)erroradapter methods on@protocoldeclarations.TypeDeclarationGeneratorstill marked@Throwsinterface methods asNS_SWIFT_UNAVAILABLEand skippedNS_SWIFT_NAME. Because no throwing replacement existed on the@protocol, Swift callers could not call these methods on interface references at all.TypeDeclarationGeneratoronly emitsNS_SWIFT_UNAVAILABLEon non-interface@Throwsmethods, keeping interface methods callable in Swift with theirNS_SWIFT_NAMEannotation.