Skip to content

Do not emit NS_SWIFT_UNAVAILABLE on @Throws interface methods. - #2902

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_1009085524
Oct 29, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_1009085524

Conversation

@copybara-service

Copy link
Copy Markdown

Do not emit NS_SWIFT_UNAVAILABLE on @throws interface methods.

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.

@copybara-service
copybara-service Bot force-pushed the test_1009085524 branch 2 times, most recently from a3ca760 to 47aba76 Compare October 29, 2026 18:58
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
copybara-service Bot merged commit 9f39113 into master Oct 29, 2026
1 check passed
@copybara-service
copybara-service Bot deleted the test_1009085524 branch October 29, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant