Skip to content

[pigeon] Make Kotlin FlutterError a runtime error#11469

Merged
auto-submit[bot] merged 1 commit intoflutter:mainfrom
stuartmorgan-g:pigeon-kotlin-error-runtime
Apr 8, 2026
Merged

[pigeon] Make Kotlin FlutterError a runtime error#11469
auto-submit[bot] merged 1 commit intoflutter:mainfrom
stuartmorgan-g:pigeon-kotlin-error-runtime

Conversation

@stuartmorgan-g
Copy link
Copy Markdown
Collaborator

@stuartmorgan-g stuartmorgan-g commented Apr 8, 2026

Change the Kotlin generator's FlutterError to inherit from RuntimeException, rather than just Runnable, so that it behaves as an unchecked error when used from Java (as is the case for the Java version).

Fixes flutter/flutter#184200

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

Change the Kotlin generator's `FlutterError` to inherit from
`RuntimException`, rather than just `Runnable`, so that it behaves as an
unchecked error when used from Java (as is the case for the Java
version).

Fixes flutter/flutter#184200
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Pigeon generator to make generated error classes inherit from RuntimeException instead of Throwable, improving Java interoperability. The change includes updates to the Kotlin generator, platform test files, and the package version. A test case was added to verify the inheritance, and a suggestion was provided to make the test assertion more robust by specifically targeting the FlutterError class definition.

Copy link
Copy Markdown
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

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

This isn't breaking at all?

@stuartmorgan-g
Copy link
Copy Markdown
Collaborator Author

This isn't breaking at all?

RuntimeException inherits from Throwable, so anything assuming it's a Throwable will still be fine. I checked that throws FlutterError as an annotation is fine even for a RuntimeException (it's just no longer required). I couldn't think of any plausible cases that would be broken.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@auto-submit auto-submit bot merged commit 617d2bd into flutter:main Apr 8, 2026
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: pigeon platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pigeon] Fix Kotlin/Java interop for sync methods that throw

2 participants