[pigeon] Support javax.annotation.Generated annotation in Kotlin generator#10961
[pigeon] Support javax.annotation.Generated annotation in Kotlin generator#10961auto-submit[bot] merged 33 commits intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to add a javax.annotation.Generated annotation to the generated Kotlin code, controlled by a new useGeneratedAnnotation flag. The implementation correctly adds the flag to the options, parses it from command-line arguments, and conditionally adds the annotation in the Kotlin generator. The changes are accompanied by corresponding tests. My review includes suggestions to improve code maintainability by refactoring a magic string into a constant and reducing code duplication in the newly added tests.
|
Having difficulties executing will set up dart env locally and reformat or manually make changes |
There will be hundreds of changes if you can't run the formatter. I would highly recommend not doing it manually. Or I can format your code and push it up. If that's easier for you. |
|
Managed to install dart! PTAL! (I don't know how to trigger AI review again) |
… setup
- Extract @javax.annotation.Generated("dev.flutter.pigeon") to shared constant in generator_tools.dart
- Update kotlin_generator.dart and java_generator.dart to use shared constant
- Refactor kotlin_generator_test.dart and java_generator_test.dart to use group() with setUp() pattern
- Eliminates code duplication in test initialization across generator tests
tarrinneal
left a comment
There was a problem hiding this comment.
This all looks good. The "magic strings" comment from the ai is pretty funny when you look at the rest of the generator files, but there will be some upcoming changes in that regard soon anyway, so might as well start here :)
I do think it would be a good idea to add the annotations to at least one of the generated test files, should be as simple as adding a parameter to the 'runPigeon' method in the 'generation.dart' file in the tool/shared directory. Then adding an argument to the call to that method in generateTestPigeons in the same file for one file.
- Add kotlinUseGeneratedAnnotation parameter to runPigeon method - Pass useGeneratedAnnotation to KotlinOptions - Enable annotation for core_tests in generated test files
- Add javaUseGeneratedAnnotation parameter to runPigeon method - Pass useGeneratedAnnotation to JavaOptions in PigeonOptions - Update test case to enable annotation for both Kotlin and Java - Generates CoreTestsWithAnnotation files for both languages
- Add type annotation for corePascalCaseName (String) - Make generateCodeWithAnnotation variable final - Remove redundant kotlinIncludeErrorClass: true (matches default)
tarrinneal
left a comment
There was a problem hiding this comment.
Sorry I forgot to approve last time
|
autosubmit label was removed for flutter/packages/10961, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.
|
stuartmorgan-g
left a comment
There was a problem hiding this comment.
The code looks good, but since this is new API it needs to be a minor version bump since we use semver.
flutter/packages@fe3de64...c717018 2026-03-09 23180853+jeffkwoh@users.noreply.github.com [pigeon] Support javax.annotation.Generated annotation in Kotlin generator (flutter/packages#10961) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider/example/android/app (flutter/packages#11206) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump com.android.tools.build:gradle from 8.9.1 to 9.1.0 in /packages/shared_preferences/shared_preferences_android/example/android/app (flutter/packages#11208) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider_android/example/android/app (flutter/packages#11207) 2026-03-06 stuartmorgan@google.com [various] Plugin Gradle pre-Kotlin standardization (flutter/packages#11173) 2026-03-06 jessiewong401@gmail.com Updated AGP and KGP to align with flutter/flutter templates (flutter/packages#10423) 2026-03-06 engine-flutter-autoroll@skia.org Roll Flutter from d3dd774 to d182143 (33 revisions) (flutter/packages#11191) 2026-03-06 20989940+aednlaxer@users.noreply.github.com [google_maps_flutter] Add Advanced Markers support (flutter/packages#7882) 2026-03-06 47250617+linchen00@users.noreply.github.com [in_app_purchase]Fixes StoreKit 2 purchase flow to send cancelled/pending/unverified results to purchaseStream. (flutter/packages#10736) 2026-03-06 theandroidseb@gmail.com [flutter_svg] Update README with an example to scale images (flutter/packages#10547) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…er#183396) flutter/packages@fe3de64...c717018 2026-03-09 23180853+jeffkwoh@users.noreply.github.com [pigeon] Support javax.annotation.Generated annotation in Kotlin generator (flutter/packages#10961) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider/example/android/app (flutter/packages#11206) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump com.android.tools.build:gradle from 8.9.1 to 9.1.0 in /packages/shared_preferences/shared_preferences_android/example/android/app (flutter/packages#11208) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider_android/example/android/app (flutter/packages#11207) 2026-03-06 stuartmorgan@google.com [various] Plugin Gradle pre-Kotlin standardization (flutter/packages#11173) 2026-03-06 jessiewong401@gmail.com Updated AGP and KGP to align with flutter/flutter templates (flutter/packages#10423) 2026-03-06 engine-flutter-autoroll@skia.org Roll Flutter from d3dd774 to d182143 (33 revisions) (flutter/packages#11191) 2026-03-06 20989940+aednlaxer@users.noreply.github.com [google_maps_flutter] Add Advanced Markers support (flutter/packages#7882) 2026-03-06 47250617+linchen00@users.noreply.github.com [in_app_purchase]Fixes StoreKit 2 purchase flow to send cancelled/pending/unverified results to purchaseStream. (flutter/packages#10736) 2026-03-06 theandroidseb@gmail.com [flutter_svg] Update README with an example to scale images (flutter/packages#10547) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…rator (flutter#10961) Adds supports for a flag to add a javax.annotation.Generated annotation in the Kotlin generated code Fixes flutter/flutter#181234
…er#183396) flutter/packages@fe3de64...c717018 2026-03-09 23180853+jeffkwoh@users.noreply.github.com [pigeon] Support javax.annotation.Generated annotation in Kotlin generator (flutter/packages#10961) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider/example/android/app (flutter/packages#11206) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump com.android.tools.build:gradle from 8.9.1 to 9.1.0 in /packages/shared_preferences/shared_preferences_android/example/android/app (flutter/packages#11208) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider_android/example/android/app (flutter/packages#11207) 2026-03-06 stuartmorgan@google.com [various] Plugin Gradle pre-Kotlin standardization (flutter/packages#11173) 2026-03-06 jessiewong401@gmail.com Updated AGP and KGP to align with flutter/flutter templates (flutter/packages#10423) 2026-03-06 engine-flutter-autoroll@skia.org Roll Flutter from d3dd774 to d182143 (33 revisions) (flutter/packages#11191) 2026-03-06 20989940+aednlaxer@users.noreply.github.com [google_maps_flutter] Add Advanced Markers support (flutter/packages#7882) 2026-03-06 47250617+linchen00@users.noreply.github.com [in_app_purchase]Fixes StoreKit 2 purchase flow to send cancelled/pending/unverified results to purchaseStream. (flutter/packages#10736) 2026-03-06 theandroidseb@gmail.com [flutter_svg] Update README with an example to scale images (flutter/packages#10547) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…er#183396) flutter/packages@fe3de64...c717018 2026-03-09 23180853+jeffkwoh@users.noreply.github.com [pigeon] Support javax.annotation.Generated annotation in Kotlin generator (flutter/packages#10961) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider/example/android/app (flutter/packages#11206) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump com.android.tools.build:gradle from 8.9.1 to 9.1.0 in /packages/shared_preferences/shared_preferences_android/example/android/app (flutter/packages#11208) 2026-03-09 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.4.0 in /packages/path_provider/path_provider_android/example/android/app (flutter/packages#11207) 2026-03-06 stuartmorgan@google.com [various] Plugin Gradle pre-Kotlin standardization (flutter/packages#11173) 2026-03-06 jessiewong401@gmail.com Updated AGP and KGP to align with flutter/flutter templates (flutter/packages#10423) 2026-03-06 engine-flutter-autoroll@skia.org Roll Flutter from d3dd774 to d182143 (33 revisions) (flutter/packages#11191) 2026-03-06 20989940+aednlaxer@users.noreply.github.com [google_maps_flutter] Add Advanced Markers support (flutter/packages#7882) 2026-03-06 47250617+linchen00@users.noreply.github.com [in_app_purchase]Fixes StoreKit 2 purchase flow to send cancelled/pending/unverified results to purchaseStream. (flutter/packages#10736) 2026-03-06 theandroidseb@gmail.com [flutter_svg] Update README with an example to scale images (flutter/packages#10547) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Adds supports for a flag to add a javax.annotation.Generated annotation in the Kotlin generated code
Fixes flutter/flutter#181234