Fixed
Status Update
Comments
as...@google.com <as...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit b582fb45576c43c28c494f4a893d7afe37f80928
Author: Julia McClellan <juliamcclellan@google.com>
Date: Mon Apr 25 13:25:19 2022
Added lint check for empty navDeepLink in Kotlin DSL.
Adding in a lint check to provide a warning to users that attempt to create a NavDeepLink using the Kotlin DSL navDeepLink function. Using an empty NavDeepLink will result in a runtime exception as a deep link with a url, action, and/or mimetype is invalid.
Relnote: Attempting to create an empty NavDeepLink using the navDeepLink Kotlin DSL will not result in a lint warning indicating that a deep link needs an uri, action, and/or mimetype to be valid.
Test: Included tests of API version and the lint rule
Bug: 154038883
Change-Id: I08d2feba9b90ee934b8834c5573914fa44d7dc45
M navigation/navigation-common/build.gradle
M settings.gradle
A navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/NavigationCommonIssueRegistry.kt
A navigation/navigation-common-lint/build.gradle
A navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/EmptyNavDeepLinkDetectorTest.kt
A navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/EmptyNavDeepLinkDetector.kt
A navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/ApiLintVersionsTest.kt
A navigation/navigation-common-lint/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry
https://android-review.googlesource.com/2080260
Branch: androidx-main
commit b582fb45576c43c28c494f4a893d7afe37f80928
Author: Julia McClellan <juliamcclellan@google.com>
Date: Mon Apr 25 13:25:19 2022
Added lint check for empty navDeepLink in Kotlin DSL.
Adding in a lint check to provide a warning to users that attempt to create a NavDeepLink using the Kotlin DSL navDeepLink function. Using an empty NavDeepLink will result in a runtime exception as a deep link with a url, action, and/or mimetype is invalid.
Relnote: Attempting to create an empty NavDeepLink using the navDeepLink Kotlin DSL will not result in a lint warning indicating that a deep link needs an uri, action, and/or mimetype to be valid.
Test: Included tests of API version and the lint rule
Bug: 154038883
Change-Id: I08d2feba9b90ee934b8834c5573914fa44d7dc45
M navigation/navigation-common/build.gradle
M settings.gradle
A navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/NavigationCommonIssueRegistry.kt
A navigation/navigation-common-lint/build.gradle
A navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/EmptyNavDeepLinkDetectorTest.kt
A navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/EmptyNavDeepLinkDetector.kt
A navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/ApiLintVersionsTest.kt
A navigation/navigation-common-lint/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry
ju...@google.com <ju...@google.com>
na...@google.com <na...@google.com> #3
This bug was linked in a change in the following release(s):
androidx.navigation:navigation-common:2.6.0-alpha01
Description
Navigation recently added support for actions and mimeTypes inside of deep links.
There is also a new NavDeepLink Kotlin DSL .
While is is not possible to construct an empty NavDeepLink from java, you can do so from the Kotlin DSL and it will throw an IllegalStateException.
We should add a lint check to notify developers that when using the Kotlin DSL a NavDeepLink must have an uri, action, and/or mimetype or it is invalid.