Move lint test utils to common-test module

Test utils cannot be referenced in production code, so we need to move test utils to test source set.

Test: existing tests pass
Bug: 371926651
Change-Id: I9db9b1e53d54492f1000cf45342d08993908ccc1
diff --git a/navigation/lint/common/src/main/java/androidx/navigation/lint/TestStub.kt b/navigation/lint/common-test/src/main/java/androidx/navigation/lint/test/Stubs.kt
similarity index 99%
rename from navigation/lint/common/src/main/java/androidx/navigation/lint/TestStub.kt
rename to navigation/lint/common-test/src/main/java/androidx/navigation/lint/test/Stubs.kt
index 46de2f9a..5ec5ba6 100644
--- a/navigation/lint/common/src/main/java/androidx/navigation/lint/TestStub.kt
+++ b/navigation/lint/common-test/src/main/java/androidx/navigation/lint/test/Stubs.kt
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package androidx.navigation.lint
+package androidx.navigation.lint.test
 
 internal val NAV_CONTROLLER =
     bytecodeStub(
diff --git a/navigation/lint/common-test/src/main/java/androidx/navigation/lint/test/Util.kt b/navigation/lint/common-test/src/main/java/androidx/navigation/lint/test/Util.kt
new file mode 100644
index 0000000..807bbbc
--- /dev/null
+++ b/navigation/lint/common-test/src/main/java/androidx/navigation/lint/test/Util.kt
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.navigation.lint.test
+
+import org.intellij.lang.annotations.Language
+
+/**
+ * Workaround for b/371463741
+ *
+ * Once the new lint common structure is merged, we should replace this helper with the
+ * kotlinAndBytecodeStub helper from compose.lint.test.stubs
+ *
+ * @param filename name of the Kotlin source file, with extension - e.g. "Test.kt". These should be
+ *   unique across a test.
+ * @param filepath directory structure matching the package name of the Kotlin source file. E.g. if
+ *   the source has `package foo.bar`, this should be `foo/bar`. If this does _not_ match, lint will
+ *   not be able to match the generated classes with the source file, and so won't print them to
+ *   console.
+ * @param source Kotlin source for the bytecode
+ * @param bytecode generated bytecode that will be used in tests. Leave empty to generate the
+ *   bytecode for [source].
+ * @return CompatKotlinAndBytecodeStub
+ */
+fun kotlinAndBytecodeStub(
+    filename: String,
+    filepath: String,
+    checksum: Long,
+    @Language("kotlin") source: String,
+    vararg bytecode: String
+) = CompatKotlinAndBytecodeStub(filename, filepath, checksum, source, *bytecode)
+
+/**
+ * Workaround for b/371463741
+ *
+ * Once the new lint common structure is merged, we should replace this helper with the
+ * kotlinAndBytecodeStub helper from compose.lint.test.stubs
+ *
+ * @param filename name of the Kotlin source file, with extension - e.g. "Test.kt". These should be
+ *   unique across a test.
+ * @param filepath directory structure matching the package name of the Kotlin source file. E.g. if
+ *   the source has `package foo.bar`, this should be `foo/bar`. If this does _not_ match, lint will
+ *   not be able to match the generated classes with the source file, and so won't print them to
+ *   console.
+ * @param source Kotlin source for the bytecode
+ * @param bytecode generated bytecode that will be used in tests. Leave empty to generate the
+ *   bytecode for [source].
+ * @return CompatKotlinAndBytecodeStub
+ */
+fun bytecodeStub(
+    filename: String,
+    filepath: String,
+    checksum: Long,
+    @Language("kotlin") source: String,
+    vararg bytecode: String
+) = CompatKotlinAndBytecodeStub(filename, filepath, checksum, source, *bytecode)
+
+/**
+ * Workaround for b/371463741
+ *
+ * Once the new lint common structure is merged, delete this compat class
+ */
+class CompatKotlinAndBytecodeStub(
+    val filename: String,
+    val filepath: String,
+    val checksum: Long,
+    @Language("kotlin") val source: String,
+    vararg val bytecode: String
+)
diff --git a/navigation/lint/common/build.gradle b/navigation/lint/common/build.gradle
index 4ed49c5..4d4b83b 100644
--- a/navigation/lint/common/build.gradle
+++ b/navigation/lint/common/build.gradle
@@ -29,7 +29,7 @@
 }
 
 dependencies {
-    compileOnly(libs.androidLintMinApi)
+    compileOnly(libs.androidLintApiPrevKotlin)
     compileOnly(libs.kotlinStdlib)
 }
 
diff --git a/navigation/lint/common/src/main/java/androidx/navigation/lint/LintUtil.kt b/navigation/lint/common/src/main/java/androidx/navigation/lint/LintUtil.kt
deleted file mode 100644
index 06d8927..0000000
--- a/navigation/lint/common/src/main/java/androidx/navigation/lint/LintUtil.kt
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.navigation.lint
-
-import com.intellij.psi.PsiClass
-import com.intellij.psi.impl.source.PsiClassReferenceType
-import org.intellij.lang.annotations.Language
-import org.jetbrains.kotlin.analysis.api.analyze
-import org.jetbrains.kotlin.analysis.api.symbols.KtClassKind
-import org.jetbrains.kotlin.analysis.api.symbols.KtClassOrObjectSymbol
-import org.jetbrains.kotlin.idea.references.mainReference
-import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
-import org.jetbrains.kotlin.psi.KtExpression
-import org.jetbrains.kotlin.psi.KtReferenceExpression
-import org.jetbrains.uast.UClassLiteralExpression
-import org.jetbrains.uast.UExpression
-import org.jetbrains.uast.UQualifiedReferenceExpression
-import org.jetbrains.uast.USimpleNameReferenceExpression
-
-/** Catches simple class/interface name reference */
-fun UExpression.isClassReference(
-    checkClass: Boolean = true,
-    checkInterface: Boolean = true,
-    checkCompanion: Boolean = true
-): Pair<Boolean, String?> {
-    /**
-     * True if:
-     * 1. reference to object (i.e. val myStart = TestStart(), startDest = myStart)
-     * 2. object declaration (i.e. object MyStart, startDest = MyStart)
-     * 3. class reference (i.e. class MyStart, startDest = MyStart)
-     *
-     *    We only want to catch case 3., so we need more filters to eliminate case 1 & 2.
-     */
-    val isSimpleRefExpression = this is USimpleNameReferenceExpression
-
-    /** True if nested class i.e. OuterClass.InnerClass */
-    val isQualifiedRefExpression = this is UQualifiedReferenceExpression
-
-    if (!(isSimpleRefExpression || isQualifiedRefExpression)) return false to null
-
-    val sourcePsi = sourcePsi as? KtExpression ?: return false to null
-    return analyze(sourcePsi) {
-        val symbol =
-            when (sourcePsi) {
-                is KtDotQualifiedExpression -> {
-                    val lastChild = sourcePsi.lastChild
-                    if (lastChild is KtReferenceExpression) {
-                        lastChild.mainReference.resolveToSymbol()
-                    } else {
-                        null
-                    }
-                }
-                is KtReferenceExpression -> sourcePsi.mainReference.resolveToSymbol()
-                else -> null
-            }
-                as? KtClassOrObjectSymbol ?: return false to null
-
-        ((checkClass && symbol.classKind.isClass) ||
-            (checkInterface && symbol.classKind == KtClassKind.INTERFACE) ||
-            (checkCompanion && symbol.classKind == KtClassKind.COMPANION_OBJECT)) to
-            symbol.name?.asString()
-    }
-}
-
-fun UExpression.getKClassType(): PsiClass? {
-    // filter for KClass<*>
-    if (this !is UClassLiteralExpression) return null
-
-    val expressionType = getExpressionType() ?: return null
-    if (expressionType !is PsiClassReferenceType) return null
-    val typeArg = expressionType.typeArguments().firstOrNull() ?: return null
-    return (typeArg as? PsiClassReferenceType)?.reference?.resolve() as? PsiClass
-}
-
-/**
- * Workaround for b/371463741
- *
- * Once the new lint common structure is merged, we should replace this helper with the
- * kotlinAndBytecodeStub helper from compose.lint.test.stubs
- *
- * @param filename name of the Kotlin source file, with extension - e.g. "Test.kt". These should be
- *   unique across a test.
- * @param filepath directory structure matching the package name of the Kotlin source file. E.g. if
- *   the source has `package foo.bar`, this should be `foo/bar`. If this does _not_ match, lint will
- *   not be able to match the generated classes with the source file, and so won't print them to
- *   console.
- * @param source Kotlin source for the bytecode
- * @param bytecode generated bytecode that will be used in tests. Leave empty to generate the
- *   bytecode for [source].
- * @return CompatKotlinAndBytecodeStub
- */
-fun kotlinAndBytecodeStub(
-    filename: String,
-    filepath: String,
-    checksum: Long,
-    @Language("kotlin") source: String,
-    vararg bytecode: String
-) = CompatKotlinAndBytecodeStub(filename, filepath, checksum, source, *bytecode)
-
-/**
- * Workaround for b/371463741
- *
- * Once the new lint common structure is merged, we should replace this helper with the
- * kotlinAndBytecodeStub helper from compose.lint.test.stubs
- *
- * @param filename name of the Kotlin source file, with extension - e.g. "Test.kt". These should be
- *   unique across a test.
- * @param filepath directory structure matching the package name of the Kotlin source file. E.g. if
- *   the source has `package foo.bar`, this should be `foo/bar`. If this does _not_ match, lint will
- *   not be able to match the generated classes with the source file, and so won't print them to
- *   console.
- * @param source Kotlin source for the bytecode
- * @param bytecode generated bytecode that will be used in tests. Leave empty to generate the
- *   bytecode for [source].
- * @return CompatKotlinAndBytecodeStub
- */
-fun bytecodeStub(
-    filename: String,
-    filepath: String,
-    checksum: Long,
-    @Language("kotlin") source: String,
-    vararg bytecode: String
-) = CompatKotlinAndBytecodeStub(filename, filepath, checksum, source, *bytecode)
-
-/**
- * Workaround for b/371463741
- *
- * Once the new lint common structure is merged, delete this compat class
- */
-class CompatKotlinAndBytecodeStub(
-    val filename: String,
-    val filepath: String,
-    val checksum: Long,
-    @Language("kotlin") val source: String,
-    vararg val bytecode: String
-)
diff --git a/navigation/lint/common/src/main/java/androidx/navigation/lint/Util.kt b/navigation/lint/common/src/main/java/androidx/navigation/lint/Util.kt
new file mode 100644
index 0000000..5c1e44d
--- /dev/null
+++ b/navigation/lint/common/src/main/java/androidx/navigation/lint/Util.kt
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.navigation.lint
+
+import com.intellij.psi.PsiClass
+import com.intellij.psi.impl.source.PsiClassReferenceType
+import org.jetbrains.kotlin.analysis.api.analyze
+import org.jetbrains.kotlin.analysis.api.symbols.KaClassKind
+import org.jetbrains.kotlin.analysis.api.symbols.KaClassSymbol
+import org.jetbrains.kotlin.idea.references.mainReference
+import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
+import org.jetbrains.kotlin.psi.KtExpression
+import org.jetbrains.kotlin.psi.KtReferenceExpression
+import org.jetbrains.uast.UClassLiteralExpression
+import org.jetbrains.uast.UExpression
+import org.jetbrains.uast.UQualifiedReferenceExpression
+import org.jetbrains.uast.USimpleNameReferenceExpression
+
+/** Catches simple class/interface name reference */
+fun UExpression.isClassReference(
+    checkClass: Boolean = true,
+    checkInterface: Boolean = true,
+    checkCompanion: Boolean = true
+): Pair<Boolean, String?> {
+    /**
+     * True if:
+     * 1. reference to object (i.e. val myStart = TestStart(), startDest = myStart)
+     * 2. object declaration (i.e. object MyStart, startDest = MyStart)
+     * 3. class reference (i.e. class MyStart, startDest = MyStart)
+     *
+     *    We only want to catch case 3., so we need more filters to eliminate case 1 & 2.
+     */
+    val isSimpleRefExpression = this is USimpleNameReferenceExpression
+
+    /** True if nested class i.e. OuterClass.InnerClass */
+    val isQualifiedRefExpression = this is UQualifiedReferenceExpression
+
+    if (!(isSimpleRefExpression || isQualifiedRefExpression)) return false to null
+
+    val sourcePsi = sourcePsi as? KtExpression ?: return false to null
+    return analyze(sourcePsi) {
+        val symbol =
+            when (sourcePsi) {
+                is KtDotQualifiedExpression -> {
+                    val lastChild = sourcePsi.lastChild
+                    if (lastChild is KtReferenceExpression) {
+                        lastChild.mainReference.resolveToSymbol()
+                    } else {
+                        null
+                    }
+                }
+                is KtReferenceExpression -> sourcePsi.mainReference.resolveToSymbol()
+                else -> null
+            }
+                as? KaClassSymbol ?: return false to null
+
+        ((checkClass && symbol.classKind.isClass) ||
+            (checkInterface && symbol.classKind == KaClassKind.INTERFACE) ||
+            (checkCompanion && symbol.classKind == KaClassKind.COMPANION_OBJECT)) to
+            symbol.name?.asString()
+    }
+}
+
+fun UExpression.getKClassType(): PsiClass? {
+    // filter for KClass<*>
+    if (this !is UClassLiteralExpression) return null
+
+    val expressionType = getExpressionType() ?: return null
+    if (expressionType !is PsiClassReferenceType) return null
+    @Suppress("UnstableApiUsage")
+    val typeArg = expressionType.typeArguments().firstOrNull() ?: return null
+    return (typeArg as? PsiClassReferenceType)?.reference?.resolve() as? PsiClass
+}
+
+const val MIN_ANALYSIS_API = 14
diff --git a/navigation/navigation-common-lint/build.gradle b/navigation/navigation-common-lint/build.gradle
index 2d4f37f..ddcc4d6 100644
--- a/navigation/navigation-common-lint/build.gradle
+++ b/navigation/navigation-common-lint/build.gradle
@@ -35,16 +35,18 @@
 dependencies {
     compileOnly(libs.kotlinCompiler)
     compileOnly(libs.kotlinStdlib)
-    compileOnly(libs.androidLintApiPrevAnalysis)
+    compileOnly(libs.androidLintApiPrevKotlin)
     compileOnly(libs.intellijCore)
     compileOnly(libs.uast)
 
     bundleInside(project(":navigation:lint:common"))
 
-    testImplementation(libs.androidLintPrevAnalysis)
-    testImplementation(libs.androidLintTestsPrevAnalysis)
+    testImplementation(libs.androidLintApiPrevKotlin)
+    testImplementation(libs.androidLintTestsPrevKotlin)
     testImplementation(libs.junit)
     testImplementation(libs.truth)
+    testImplementation(project(":navigation:lint:common-test"))
+
 }
 
 androidx {
diff --git a/navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/NavigationCommonIssueRegistry.kt b/navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/NavigationCommonIssueRegistry.kt
index 25e2737..22826fb 100644
--- a/navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/NavigationCommonIssueRegistry.kt
+++ b/navigation/navigation-common-lint/src/main/java/androidx/navigation/common/lint/NavigationCommonIssueRegistry.kt
@@ -18,6 +18,7 @@
 
 package androidx.navigation.common.lint
 
+import androidx.navigation.lint.MIN_ANALYSIS_API
 import com.android.tools.lint.client.api.IssueRegistry
 import com.android.tools.lint.client.api.Vendor
 import com.android.tools.lint.detector.api.CURRENT_API
@@ -25,8 +26,10 @@
 /** [IssueRegistry] containing common specific lint issues. */
 class NavigationCommonIssueRegistry : IssueRegistry() {
     // Tests are run with this version. We ensure that with ApiLintVersionsTest
-    override val api = 14
-    override val minApi = CURRENT_API
+    override val api = CURRENT_API
+    // hardcode minApi to 14 because lint dep version 31.8 has CURRENT_API as 16, but
+    // analysis API requires minApi 14
+    override val minApi = MIN_ANALYSIS_API
 
     override val issues
         get() =
diff --git a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/CompatUtil.kt b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/CompatUtil.kt
index 6f7b2261..932e432 100644
--- a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/CompatUtil.kt
+++ b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/CompatUtil.kt
@@ -16,7 +16,7 @@
 
 package androidx.navigation.common.lint
 
-import androidx.navigation.lint.CompatKotlinAndBytecodeStub
+import androidx.navigation.lint.test.CompatKotlinAndBytecodeStub
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest.kotlin
 import com.android.tools.lint.checks.infrastructure.TestFile
 import com.android.tools.lint.checks.infrastructure.TestFiles
@@ -43,4 +43,4 @@
 
 class KotlinAndBytecodeStub(val kotlin: TestFile, val bytecode: TestFile)
 
-val NAV_DEEP_LINK = androidx.navigation.lint.NAV_DEEP_LINK.toTestBytecodeStub()
+val NAV_DEEP_LINK = androidx.navigation.lint.test.NAV_DEEP_LINK.toTestBytecodeStub()
diff --git a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingKeepAnnotationDetectorTest.kt b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingKeepAnnotationDetectorTest.kt
index e218572..73353a8 100644
--- a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingKeepAnnotationDetectorTest.kt
+++ b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingKeepAnnotationDetectorTest.kt
@@ -16,8 +16,8 @@
 
 package androidx.navigation.common.lint
 
-import androidx.navigation.lint.KEEP_ANNOTATION
-import androidx.navigation.lint.NAVIGATION_STUBS
+import androidx.navigation.lint.test.KEEP_ANNOTATION
+import androidx.navigation.lint.test.NAVIGATION_STUBS
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.detector.api.Detector
 import com.android.tools.lint.detector.api.Issue
diff --git a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingSerializableAnnotationDetectorTest.kt b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingSerializableAnnotationDetectorTest.kt
index 68b30e2..6daa99c 100644
--- a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingSerializableAnnotationDetectorTest.kt
+++ b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/MissingSerializableAnnotationDetectorTest.kt
@@ -16,10 +16,10 @@
 
 package androidx.navigation.common.lint
 
-import androidx.navigation.lint.K_SERIALIZER
-import androidx.navigation.lint.NAVIGATION_STUBS
-import androidx.navigation.lint.SERIALIZABLE_ANNOTATION
-import androidx.navigation.lint.bytecodeStub
+import androidx.navigation.lint.test.K_SERIALIZER
+import androidx.navigation.lint.test.NAVIGATION_STUBS
+import androidx.navigation.lint.test.SERIALIZABLE_ANNOTATION
+import androidx.navigation.lint.test.bytecodeStub
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.detector.api.Detector
 import com.android.tools.lint.detector.api.Issue
@@ -776,6 +776,6 @@
             .map { it.toTestBytecodeStub() }
             .toTypedArray()
     val SERIALIZABLE_TEST_CLASS =
-        androidx.navigation.lint.SERIALIZABLE_TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
-    val TEST_CLASS = androidx.navigation.lint.TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
+        androidx.navigation.lint.test.SERIALIZABLE_TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
+    val TEST_CLASS = androidx.navigation.lint.test.TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
 }
diff --git a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/WrongStartDestinationTypeDetectorTest.kt b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/WrongStartDestinationTypeDetectorTest.kt
index 1045a9b..a9268fc 100644
--- a/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/WrongStartDestinationTypeDetectorTest.kt
+++ b/navigation/navigation-common-lint/src/test/java/androidx/navigation/common/lint/WrongStartDestinationTypeDetectorTest.kt
@@ -16,8 +16,8 @@
 
 package androidx.navigation.common.lint
 
-import androidx.navigation.lint.NAVIGATION_STUBS
-import androidx.navigation.lint.TEST_CLASS
+import androidx.navigation.lint.test.NAVIGATION_STUBS
+import androidx.navigation.lint.test.TEST_CLASS
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.checks.infrastructure.TestMode
 import com.android.tools.lint.detector.api.Detector
diff --git a/navigation/navigation-compose-lint/build.gradle b/navigation/navigation-compose-lint/build.gradle
index 5755e34..bfda75d 100644
--- a/navigation/navigation-compose-lint/build.gradle
+++ b/navigation/navigation-compose-lint/build.gradle
@@ -32,7 +32,7 @@
 BundleInsideHelper.forInsideLintJar(project)
 
 dependencies {
-    compileOnly(libs.androidLintMinApi)
+    compileOnly(libs.androidLintApiPrevKotlin)
     compileOnly(libs.kotlinStdlib)
     compileOnly(libs.intellijCore)
     compileOnly(libs.uast)
@@ -42,10 +42,11 @@
     testRuntimeOnly(libs.kotlinReflect)
 
     testImplementation(project(":compose:lint:common-test"))
+    testImplementation(project(":navigation:lint:common-test"))
     testImplementation(libs.kotlinStdlib)
     testImplementation(libs.kotlinStdlibJdk8)
-    testImplementation(libs.androidLintApiPrevAnalysis)
-    testImplementation(libs.androidLintTestsPrevAnalysis)
+    testImplementation(libs.androidLintApiPrevKotlin)
+    testImplementation(libs.androidLintTestsPrevKotlin)
     testImplementation(libs.junit)
 }
 
diff --git a/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt b/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt
index ed416b93..0acb0df 100644
--- a/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt
+++ b/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt
@@ -18,6 +18,7 @@
 
 package androidx.navigation.compose.lint
 
+import androidx.navigation.lint.MIN_ANALYSIS_API
 import com.android.tools.lint.client.api.IssueRegistry
 import com.android.tools.lint.client.api.Vendor
 import com.android.tools.lint.detector.api.CURRENT_API
@@ -25,8 +26,8 @@
 /** [IssueRegistry] containing runtime specific lint issues. */
 class NavigationComposeIssueRegistry : IssueRegistry() {
     // Tests are run with this version. We ensure that with ApiLintVersionsTest
-    override val api = 14
-    override val minApi = CURRENT_API
+    override val api = CURRENT_API
+    override val minApi = MIN_ANALYSIS_API
 
     override val issues
         get() =
diff --git a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/CompatUtil.kt b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/CompatUtil.kt
index 65e10fc..ab06c60 100644
--- a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/CompatUtil.kt
+++ b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/CompatUtil.kt
@@ -16,7 +16,7 @@
 
 package androidx.navigation.compose.lint
 
-import androidx.navigation.lint.CompatKotlinAndBytecodeStub
+import androidx.navigation.lint.test.CompatKotlinAndBytecodeStub
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest.kotlin
 import com.android.tools.lint.checks.infrastructure.TestFile
 import com.android.tools.lint.checks.infrastructure.TestFiles
@@ -43,4 +43,4 @@
 
 class KotlinAndBytecodeStub(val kotlin: TestFile, val bytecode: TestFile)
 
-val NAV_DEEP_LINK = androidx.navigation.lint.NAV_DEEP_LINK.toTestBytecodeStub()
+val NAV_DEEP_LINK = androidx.navigation.lint.test.NAV_DEEP_LINK.toTestBytecodeStub()
diff --git a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingKeepAnnotationDetectorTest.kt b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingKeepAnnotationDetectorTest.kt
index 22d72c7..710b052 100644
--- a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingKeepAnnotationDetectorTest.kt
+++ b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingKeepAnnotationDetectorTest.kt
@@ -16,8 +16,8 @@
 
 package androidx.navigation.compose.lint
 
-import androidx.navigation.lint.KEEP_ANNOTATION
-import androidx.navigation.lint.NAVIGATION_STUBS
+import androidx.navigation.lint.test.KEEP_ANNOTATION
+import androidx.navigation.lint.test.NAVIGATION_STUBS
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.detector.api.Detector
 import com.android.tools.lint.detector.api.Issue
diff --git a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingSerializableAnnotationDetectorTest.kt b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingSerializableAnnotationDetectorTest.kt
index 1953042..9debbd2 100644
--- a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingSerializableAnnotationDetectorTest.kt
+++ b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/MissingSerializableAnnotationDetectorTest.kt
@@ -16,10 +16,10 @@
 
 package androidx.navigation.compose.lint
 
-import androidx.navigation.lint.NAVIGATION_STUBS
-import androidx.navigation.lint.SERIALIZABLE_ANNOTATION
-import androidx.navigation.lint.SERIALIZABLE_TEST_CLASS
-import androidx.navigation.lint.TEST_CLASS
+import androidx.navigation.lint.test.NAVIGATION_STUBS
+import androidx.navigation.lint.test.SERIALIZABLE_ANNOTATION
+import androidx.navigation.lint.test.SERIALIZABLE_TEST_CLASS
+import androidx.navigation.lint.test.TEST_CLASS
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.detector.api.Detector
 import com.android.tools.lint.detector.api.Issue
@@ -665,6 +665,6 @@
             .map { it.toTestBytecodeStub() }
             .toTypedArray()
     val SERIALIZABLE_TEST_CLASS =
-        androidx.navigation.lint.SERIALIZABLE_TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
-    val TEST_CLASS = androidx.navigation.lint.TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
+        androidx.navigation.lint.test.SERIALIZABLE_TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
+    val TEST_CLASS = androidx.navigation.lint.test.TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
 }
diff --git a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/Stubs.kt b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/Stubs.kt
index 4f60532..0b80adc 100644
--- a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/Stubs.kt
+++ b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/Stubs.kt
@@ -205,7 +205,7 @@
     )
 
 internal val COMPOSABLE_NAV_HOST =
-    androidx.navigation.lint.bytecodeStub(
+    androidx.navigation.lint.test.bytecodeStub(
         "StartDestinationLint.kt",
         "androidx/navigation",
         0xa9664947,
@@ -261,7 +261,7 @@
     )
 
 internal val COMPOSE_NAVIGATOR_DESTINATION_BUILDER =
-    androidx.navigation.lint.bytecodeStub(
+    androidx.navigation.lint.test.bytecodeStub(
         "ComposeNavigatorDestinationBuilder.kt",
         "androidx/navigation/compose",
         0xcdeb9868,
@@ -371,7 +371,7 @@
     )
 
 internal val DIALOG_NAVIGATOR_DESTINATION_BUILDER =
-    androidx.navigation.lint.bytecodeStub(
+    androidx.navigation.lint.test.bytecodeStub(
         "DialogNavigatorDestinationBuilder.kt",
         "androidx/navigation/compose",
         0xe5b79ce2,
diff --git a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/WrongStartDestinationTypeDetectorTest.kt b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/WrongStartDestinationTypeDetectorTest.kt
index 50085d1..4b0b4ed 100644
--- a/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/WrongStartDestinationTypeDetectorTest.kt
+++ b/navigation/navigation-compose-lint/src/test/java/androidx/navigation/compose/lint/WrongStartDestinationTypeDetectorTest.kt
@@ -17,8 +17,8 @@
 package androidx.navigation.compose.lint
 
 import androidx.compose.lint.test.Stubs
-import androidx.navigation.lint.NAVIGATION_STUBS
-import androidx.navigation.lint.TEST_CLASS
+import androidx.navigation.lint.test.NAVIGATION_STUBS
+import androidx.navigation.lint.test.TEST_CLASS
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.checks.infrastructure.TestMode
 import com.android.tools.lint.detector.api.Detector
@@ -263,6 +263,6 @@
 }
 
 private val STUBS =
-    arrayOf(TEST_CLASS, COMPOSABLE_NAV_HOST, *NAVIGATION_STUBS)
+    arrayOf(*NAVIGATION_STUBS, TEST_CLASS, COMPOSABLE_NAV_HOST)
         .map { it.toTestBytecodeStub() }
         .toTypedArray()
diff --git a/navigation/navigation-runtime-lint/build.gradle b/navigation/navigation-runtime-lint/build.gradle
index 3dd38a3..d8842be 100644
--- a/navigation/navigation-runtime-lint/build.gradle
+++ b/navigation/navigation-runtime-lint/build.gradle
@@ -33,7 +33,7 @@
 BundleInsideHelper.forInsideLintJar(project)
 
 dependencies {
-    compileOnly(libs.androidLintMinApi)
+    compileOnly(libs.androidLintApiPrevKotlin)
     compileOnly(libs.kotlinStdlib)
     compileOnly(libs.androidToolsCommon)
     compileOnly(libs.intellijCore)
@@ -41,11 +41,12 @@
     bundleInside(project(":navigation:lint:common"))
 
     testImplementation(libs.kotlinStdlib)
-    testImplementation(libs.androidLintApiPrevAnalysis)
-    testImplementation(libs.androidLintTestsPrevAnalysis)
+    testImplementation(libs.androidLintApiPrevKotlin)
+    testImplementation(libs.androidLintTestsPrevKotlin)
     testImplementation(libs.intellijCore)
     testImplementation(libs.junit)
     testImplementation(libs.truth)
+    testImplementation(project(":navigation:lint:common-test"))
 }
 
 androidx {
diff --git a/navigation/navigation-runtime-lint/src/main/java/androidx/navigation/runtime/lint/NavigationRuntimeIssueRegistry.kt b/navigation/navigation-runtime-lint/src/main/java/androidx/navigation/runtime/lint/NavigationRuntimeIssueRegistry.kt
index c6a3e72..87912e3 100644
--- a/navigation/navigation-runtime-lint/src/main/java/androidx/navigation/runtime/lint/NavigationRuntimeIssueRegistry.kt
+++ b/navigation/navigation-runtime-lint/src/main/java/androidx/navigation/runtime/lint/NavigationRuntimeIssueRegistry.kt
@@ -18,6 +18,7 @@
 
 package androidx.navigation.runtime.lint
 
+import androidx.navigation.lint.MIN_ANALYSIS_API
 import com.android.tools.lint.client.api.IssueRegistry
 import com.android.tools.lint.client.api.Vendor
 import com.android.tools.lint.detector.api.CURRENT_API
@@ -25,8 +26,8 @@
 /** [IssueRegistry] containing runtime specific lint issues. */
 class NavigationRuntimeIssueRegistry : IssueRegistry() {
     // Tests are run with this version. We ensure that with ApiLintVersionsTest
-    override val api = 14
-    override val minApi = CURRENT_API
+    override val api = CURRENT_API
+    override val minApi = MIN_ANALYSIS_API
 
     override val issues
         get() =
diff --git a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/CompatUtil.kt b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/CompatUtil.kt
index a59e487..4d69cf3 100644
--- a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/CompatUtil.kt
+++ b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/CompatUtil.kt
@@ -16,7 +16,7 @@
 
 package androidx.navigation.runtime.lint
 
-import androidx.navigation.lint.CompatKotlinAndBytecodeStub
+import androidx.navigation.lint.test.CompatKotlinAndBytecodeStub
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest.kotlin
 import com.android.tools.lint.checks.infrastructure.TestFile
 import com.android.tools.lint.checks.infrastructure.TestFiles
@@ -43,4 +43,4 @@
 
 class KotlinAndBytecodeStub(val kotlin: TestFile, val bytecode: TestFile)
 
-val NAV_DEEP_LINK = androidx.navigation.lint.NAV_DEEP_LINK.toTestBytecodeStub()
+val NAV_DEEP_LINK = androidx.navigation.lint.test.NAV_DEEP_LINK.toTestBytecodeStub()
diff --git a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingKeepAnnotationDetectorTest.kt b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingKeepAnnotationDetectorTest.kt
index 945989b..966837c 100644
--- a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingKeepAnnotationDetectorTest.kt
+++ b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingKeepAnnotationDetectorTest.kt
@@ -16,8 +16,8 @@
 
 package androidx.navigation.runtime.lint
 
-import androidx.navigation.lint.KEEP_ANNOTATION
-import androidx.navigation.lint.NAVIGATION_STUBS
+import androidx.navigation.lint.test.KEEP_ANNOTATION
+import androidx.navigation.lint.test.NAVIGATION_STUBS
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.detector.api.Detector
 import com.android.tools.lint.detector.api.Issue
diff --git a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingSerializableAnnotationDetectorTest.kt b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingSerializableAnnotationDetectorTest.kt
index 313e293..068730e 100644
--- a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingSerializableAnnotationDetectorTest.kt
+++ b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/MissingSerializableAnnotationDetectorTest.kt
@@ -16,10 +16,10 @@
 
 package androidx.navigation.runtime.lint
 
-import androidx.navigation.lint.NAVIGATION_STUBS
-import androidx.navigation.lint.SERIALIZABLE_ANNOTATION
-import androidx.navigation.lint.SERIALIZABLE_TEST_CLASS
-import androidx.navigation.lint.TEST_CLASS
+import androidx.navigation.lint.test.NAVIGATION_STUBS
+import androidx.navigation.lint.test.SERIALIZABLE_ANNOTATION
+import androidx.navigation.lint.test.SERIALIZABLE_TEST_CLASS
+import androidx.navigation.lint.test.TEST_CLASS
 import com.android.tools.lint.checks.infrastructure.LintDetectorTest
 import com.android.tools.lint.detector.api.Detector
 import com.android.tools.lint.detector.api.Issue
@@ -280,6 +280,6 @@
             .map { it.toTestBytecodeStub() }
             .toTypedArray()
     val SERIALIZABLE_TEST_CLASS =
-        androidx.navigation.lint.SERIALIZABLE_TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
-    val TEST_CLASS = androidx.navigation.lint.TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
+        androidx.navigation.lint.test.SERIALIZABLE_TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
+    val TEST_CLASS = androidx.navigation.lint.test.TEST_CLASS.toTestKotlinAndBytecodeStub().kotlin
 }
diff --git a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/Stubs.kt b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/Stubs.kt
index 5447166..a5dbcc3 100644
--- a/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/Stubs.kt
+++ b/navigation/navigation-runtime-lint/src/test/java/androidx/navigation/runtime/lint/Stubs.kt
@@ -16,9 +16,9 @@
 
 package androidx.navigation.runtime.lint
 
-import androidx.navigation.lint.NAVIGATION_STUBS
-import androidx.navigation.lint.TEST_CLASS
-import androidx.navigation.lint.bytecodeStub
+import androidx.navigation.lint.test.NAVIGATION_STUBS
+import androidx.navigation.lint.test.TEST_CLASS
+import androidx.navigation.lint.test.bytecodeStub
 
 internal val ACTIVITY_NAVIGATION_DESTINATION_BUILDER =
     bytecodeStub(