Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Add @CheckResult annotation to generated Action functions
Expand for full commit details
Add @CheckResult annotation to generated Action functions
Adding the check result annotation to the Action functions and methods
generated by safeargs to ensure that developers actually use the
functions.
RelNote: "Navigation Safe Args actions are now generated with the
`@CheckResult` annotation to ensure they are used."
Test: modified all tests
Bug: 356323084
Change-Id: I14d4c00fe8fc0e994b962776e1f10b4a8a63ece4
Files:
- M
navigation/navigation-safe-args-generator/build.gradle
- M
navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaNavWriter.kt
- M
navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaTypes.kt
- M
navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinNavWriter.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/java_nav_writer_test/LongPackageFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/java_nav_writer_test/MainFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/java_nav_writer_test/SanitizedMainFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/kotlin_nav_writer_test/FunFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/kotlin_nav_writer_test/LongPackageFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/kotlin_nav_writer_test/MainFragmentDefaultParamDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/kotlin_nav_writer_test/MainFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested/LoginDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested/LoginFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested/MainFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested/RegisterFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_overridden_action/InnerSettingsDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_overridden_action/InnerSettingsFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_overridden_action/MainFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_overridden_action/SettingsDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_overridden_action/SettingsFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_same_action/MainFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_same_action/SettingsDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/java/nested_same_action/SettingsFragmentDirections.java
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested/LoginDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested/LoginFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested/MainFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested/RegisterFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/InnerSettingsDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/InnerSettingsFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/MainFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/SettingsDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/SettingsFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_same_action/MainFragmentDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_same_action/SettingsDirections.kt
- M
navigation/navigation-safe-args-generator/src/test/test-data/expected/nav_generator_test/kotlin/nested_same_action/SettingsFragmentDirections.kt
Hash: f3d29e5d85c7911cb2909239c6f2b68e974b8804
Date: Wed Feb 05 22:18:16 2025
jb...@google.com <jb...@google.com> #3
This has been fixed internally and will be available in the Navigation 2.8.7
release.
pr...@google.com <pr...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-safe-args-generator:2.9.0-alpha06
Description
Version used: 2.4.0 through 2.5.3 (doesn't happen on 2.3.5)
Devices/Android versions reproduced on: Intel mac, M1 mac, AS Dolphin 2021.3.1 Patch 1
When using defining a safeArgs fragment argument, if the arguement matches these conditions, then you recieve a compilation error:
1. Argument is an array of a parcelable data object defined in the project.
2. Argument has a name witha character length of 19 characters.
Compilation error:
Function invocation 'map(...)' expected
Reason for error:
Generated file MyClassFragmentArgs with generated function fromSavedStateHandle. The code style wraps the generated code (maybe 100 characters as standard) splitting map function invocation "map {" over two lines.
Note:
Changing wrapping for code locally in AS does not change generated file line wrapping. Assume this is caused by some code styling shipped with dependency.
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).