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
{{ message }}
Repository navigation
Kotlin imports of top-level functions and object members never resolve (import recall 62%) #3596
A Kotlin import names a declaration by package + name, and the file it lives in doesn't have to be named after it. The engine resolves the last segment as a file stem, so two common shapes never link:
Top-level functions and properties:import com.squareup.kotlinpoet.asClassName lives in a file with another name (e.g. ClassNames.kt).
Object/companion members:import com.squareup.kotlinpoet.metadata.classinspectors.ClassInspectorUtil.JAVA_DEPRECATED. The member retry (imports_may_name_member) is Java-only.
Measured
tests/tools/import_graph_accuracy.py kotlin (square/kotlinpoet, added in #3594): precision 100%, recall 62.1%, 143 missed imports. For example, ElementsClassInspector.kt → metadata/KotlinPoetMetadata.kt and classinspectors/ClassInspectorUtil.kt.
Fix direction
Set imports_may_name_member: True for Kotlin. Same retry as Java: drop up to 3 trailing segments. This handles Util.X and nested classes.
For a top-level function or property, use what the scan already knows. Each parsed file has its function names, and a Kotlin file's directory usually mirrors its package. Resolve a.b.name to the file under a …/a/b/ directory that declares a function named name; several candidates draw no edge (Dependency Attribution Error duplicate filenames #261).
Check both with import_graph_accuracy.py kotlin --samples 10.
Problem
A Kotlin import names a declaration by package + name, and the file it lives in doesn't have to be named after it. The engine resolves the last segment as a file stem, so two common shapes never link:
import com.squareup.kotlinpoet.asClassNamelives in a file with another name (e.g.ClassNames.kt).import com.squareup.kotlinpoet.metadata.classinspectors.ClassInspectorUtil.JAVA_DEPRECATED. The member retry (imports_may_name_member) is Java-only.Measured
tests/tools/import_graph_accuracy.py kotlin(square/kotlinpoet, added in #3594): precision 100%, recall 62.1%, 143 missed imports. For example,ElementsClassInspector.kt→metadata/KotlinPoetMetadata.ktandclassinspectors/ClassInspectorUtil.kt.Fix direction
imports_may_name_member: Truefor Kotlin. Same retry as Java: drop up to 3 trailing segments. This handlesUtil.Xand nested classes.a.b.nameto the file under a…/a/b/directory that declares a function namedname; several candidates draw no edge (Dependency Attribution Error duplicate filenames #261).Check both with
import_graph_accuracy.py kotlin --samples 10.