Uses of `const val` not detected properly
Plugin version 2.18.0
Gradle version 8.12.1
JDK version 17
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version 2.1.20
(Optional) reason output for bugs relating to incorrect advice
------------------------------------------------------------
You asked about the dependency ':utils'.
You have been advised to remove this dependency from 'implementation'.
------------------------------------------------------------
Describe the bug
When module :app uses a const val from a named object in :util, and the two projects use the same java package, the usage of the constant from :util is not detected. This is very similar to #1430 but the fix for that looked for the companion object specifically, which is not in play here:
// :util
object Something {
const val EXAMPLE = "example"
}
// :app
fun main() {
println(Something.EXAMPLE)
}
To Reproduce
In this reproducer, run buildHealth
Expected behavior No advice should be given
Additional context
Advice suggests removing :util dependency, which breaks compilation
Thanks for the report.
@joshfriend could you re-test this with the latest snapshot?