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
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
2.0.21
(Optional) Android Gradle Plugin (AGP) version
8.7.2
(Optional) reason output for bugs relating to incorrect advice
Unused dependencies which should be removed:
implementation(project(":diagnostics:common")) <------ incorrect
These transitive dependencies should be declared directly:
api("androidx.datastore:datastore-core:1.0.0")
api("androidx.datastore:datastore-preferences-core:1.0.0")
api(globalLibs.javaxInject)
api(globalLibs.kotlinCoroutine)
implementation("androidx.datastore:datastore:1.0.0")
implementation("com.bugsnag:bugsnag-android-core:6.7.0")
Describe the bug
When upgrading from Kotlin 2.0.0 to Kotlin 2.0.21 the dependency analysis plugin begins to incorrectly mark some of our modules as unused in other modules, even though they are explicitly used. After digging into it a bit, I discovered that for some module dependencies in /reports/dependency-analysis/<variant>/<dependency>.json the files property is different.
Using kotlin 2.0.0, files is /Users/ward.bonnefond/Development/android/shared/diagnostics/common/build/classes
Using kotlin 2.0.21 files is/Users/ward.bonnefond/Development/android/shared/diagnostics/common/build/classes/java/main
This no longer include the classes from /build/classes/kotlin as part of the module's ABI, so it gets marked as unused in most other modules that use it.
I don't see this with every module though, so I don't know what has changed with Kotlin 2.0.21 here.
To Reproduce
Steps to reproduce the behavior:
...
Expected behavior
Additional context
I will try to get a reproducer project together, but it might take me a bit of time.
The text was updated successfully, but these errors were encountered:
Thanks for the issue and especially the preliminary debugging! Based on your observation that the path to the file has changed, I suspect the plugin is excluding things with "java" in them from Kotlin ABI analysis. Two questions:
Can you confirm those generated classes were always Java? The class name suffix (_Factory) makes me think this is being generated by dagger.
Can you provide a minimal reproducer? That would help with debugging and fixing the regression.
The .class files here in /build/classes/java are not always from dagger generated classes. If the module has actual java code those class files will appear here as well.
I tried to create a reproducer project but was unable to get the same behavior, the files property was a .jar file instead of a build directory.
Build scan link
Proprietary project :(
Plugin version
2.6.1
Gradle version
8.10.2
JDK version
17 (Corretto-17.0.10.7.1)
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
2.0.21
(Optional) Android Gradle Plugin (AGP) version
8.7.2
(Optional)
reason
output for bugs relating to incorrect adviceDescribe the bug
When upgrading from Kotlin
2.0.0
to Kotlin2.0.21
the dependency analysis plugin begins to incorrectly mark some of our modules as unused in other modules, even though they are explicitly used. After digging into it a bit, I discovered that for some module dependencies in/reports/dependency-analysis/<variant>/<dependency>.json
thefiles
property is different./Users/ward.bonnefond/Development/android/shared/diagnostics/common/build/classes
/Users/ward.bonnefond/Development/android/shared/diagnostics/common/build/classes/java/main
This no longer include the classes from
/build/classes/kotlin
as part of the module's ABI, so it gets marked as unused in most other modules that use it.I don't see this with every module though, so I don't know what has changed with Kotlin 2.0.21 here.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Additional context
I will try to get a reproducer project together, but it might take me a bit of time.
The text was updated successfully, but these errors were encountered: