You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[pigeon] Implement Screaming Snake Case Conversion for Kotlin Enum Cases (#5918)
This pull request addresses issue flutter/flutter#140938 in the Pigeon package, related to the naming convention of Kotlin enum cases generated from lower camel case Dart enums. The current implementation concatenates the enum cases in uppercase, deviating from the Kotlin naming convention, specifically when dealing with multi-word names.
Changes
- Kotlin Enum Generation: Modified the writeEnum function in the Pigeon package to ensure the Kotlin generator produces enum cases in SCREAMING_SNAKE_CASE. This adheres to the Kotlin coding conventions and allows a consistent cross-platform enum naming convention across Dart, Kotlin, and Swift.
- Regex Handling: Enhanced the regex pattern to correctly transform lower camel case names to screaming snake case, considering edge cases involving numbers and special characters.
- Testing: Updated the Dart unit tests to include cases for validating the correct transformation of multi-word and complex enum names from lower camel case to screaming snake case.
Copy file name to clipboardExpand all lines: packages/pigeon/CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
## 17.0.0
2
+
3
+
***Breaking Change**[kotlin] Converts Kotlin enum case generation to SCREAMING_SNAKE_CASE.
4
+
* Updates `writeEnum` function to adhere to Kotlin naming conventions.
5
+
* Improves handling of complex names with enhanced regex patterns.
6
+
* Expands unit tests for comprehensive name conversion validation.
7
+
***Migration Note**: This change modifies the naming convention of Kotlin enum cases generated from the Pigeon package. It is recommended to review the impact on your existing codebase and update any dependent code accordingly.
Copy file name to clipboardExpand all lines: packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java
0 commit comments