Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit f85de8f1f4a1f025bcd6ae566c9ce3b4c8f1f06c
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Jan 24 16:28:34 2019
Use fully qualified ClassName for action method return names.
Using complete ClassName for action return types helps child direction
classes correctly generate their inherited action method. More precisely
it allows for deep nested direction classes to correctly import the
inner NavDirection class generated in a grandfather direction class.
Bug: 123347762
Test: ./gradlew navigation:navigation-safe-args-gradle-plugin:test \
navigation:navigation-safe-args-generator:test
Change-Id: I62a0b10b33bfe496d930782a7ef0d7269a75df96
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaNavWriter.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/InnerSettingsDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/InnerSettingsFragmentDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/SettingsDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/SettingsFragmentDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/InnerSettingsDirections.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/InnerSettingsFragmentDirections.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/SettingsDirections.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/SettingsFragmentDirections.kt
M navigation/safe-args-generator/src/tests/test-data/nested_overridden_action_test.xml
M navigation/safe-args-gradle-plugin/src/test/test-data/app-project-kotlin/src/main/res/navigation/nav_nested_test.xml
M navigation/safe-args-gradle-plugin/src/test/test-data/app-project/src/main/res/navigation/nav_nested_test.xml
https://android-review.googlesource.com/885199
https://goto.google.com/android-sha1/f85de8f1f4a1f025bcd6ae566c9ce3b4c8f1f06c
Branch: androidx-master-dev
commit f85de8f1f4a1f025bcd6ae566c9ce3b4c8f1f06c
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Jan 24 16:28:34 2019
Use fully qualified ClassName for action method return names.
Using complete ClassName for action return types helps child direction
classes correctly generate their inherited action method. More precisely
it allows for deep nested direction classes to correctly import the
inner NavDirection class generated in a grandfather direction class.
Bug: 123347762
Test: ./gradlew navigation:navigation-safe-args-gradle-plugin:test \
navigation:navigation-safe-args-generator:test
Change-Id: I62a0b10b33bfe496d930782a7ef0d7269a75df96
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaNavWriter.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/InnerSettingsDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/InnerSettingsFragmentDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/SettingsDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/java/nested_overridden_action/SettingsFragmentDirections.java
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/InnerSettingsDirections.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/InnerSettingsFragmentDirections.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/SettingsDirections.kt
M navigation/safe-args-generator/src/tests/test-data/expected/nav_generator_test/kotlin/nested_overridden_action/SettingsFragmentDirections.kt
M navigation/safe-args-generator/src/tests/test-data/nested_overridden_action_test.xml
M navigation/safe-args-gradle-plugin/src/test/test-data/app-project-kotlin/src/main/res/navigation/nav_nested_test.xml
M navigation/safe-args-gradle-plugin/src/test/test-data/app-project/src/main/res/navigation/nav_nested_test.xml
il...@google.com <il...@google.com> #3
This has been fixed internally and will be available in the next release.
Note that the Kotlin Safe Args plugin (using apply plugin: 'androidx.navigation.safeargs.kotlin') is not affected by this bug, so if you're in a Kotlin only project, consider switching to that as a workaround.
Note that when fixing this issue, we did find another issue, filed ashttps://issuetracker.google.com/issues/123374541 that *does* affect the Kotlin code gen specifically when using a argument name with the same name as the enum class you've set as the default value (in your example app, the android:name="ToolbarType"). Feel free to star that issue to track progress on that issue and note the workaround listed there).
Note that the Kotlin Safe Args plugin (using apply plugin: 'androidx.navigation.safeargs.kotlin') is not affected by this bug, so if you're in a Kotlin only project, consider switching to that as a workaround.
Note that when fixing this issue, we did find another issue, filed as
Description
Version used: alpha11
Devices/Android versions reproduced on: Android Studio 3.4 beta 2
I found a strange case, this morning, when I was trying to integrate the new alpha11 build into a project. I've replicated a minimal test case into a project and have replicated the situation.
What I see:
During build:
/Users/nealsanche/robots/Alpha11GlobalBug/app/build/generated/source/navigation-args/debug/com/robotsandpencils/testapp/tab1/Tab1FragmentDirections.java:10: error: cannot find symbol
public static com.robotsandpencils.testapp.Tab1FragmentDirections.com.robotsandpencils.testapp.NavGraphDirections.ActionGlobalGlobalFragment actionGlobalGlobalFragment() {
^
symbol: class com
location: class Tab1FragmentDirections
/Users/nealsanche/robots/Alpha11GlobalBug/app/build/generated/source/navigation-args/debug/com/robotsandpencils/testapp/tab2/Tab2FragmentDirections.java:26: error: cannot find symbol
public static com.robotsandpencils.testapp.Tab2FragmentDirections.com.robotsandpencils.testapp.NavGraphDirections.ActionGlobalGlobalFragment actionGlobalGlobalFragment() {
^
symbol: class com
location: class Tab2FragmentDirections
/Users/nealsanche/robots/Alpha11GlobalBug/app/build/generated/source/navigation-args/debug/com/robotsandpencils/testapp/tab3/Tab3FragmentDirections.java:26: error: cannot find symbol
public static com.robotsandpencils.testapp.Tab3FragmentDirections.com.robotsandpencils.testapp.NavGraphDirections.ActionGlobalGlobalFragment actionGlobalGlobalFragment() {
^
symbol: class com
location: class Tab3FragmentDirections
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
FAILURE: Build failed with an exception.
All I did was right click on the GlobalFragment and generated a 'global' action from the menu.