autonomousapps/dependency-analysis-gradle-plugin
Kotlin removes unreachable bytecode causing DAGP to think a dependency is unused
Aberta
#1.429 aberto em 30 de abr. de 2025
bughelp wantedsponsorabletoolchain:kotlin
Métricas do repositório
- Stars
- (2.172 estrelas)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
Plugin version 2.17.0
Gradle version 8.14
JDK version 17
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version 2.1.20
Describe the bug
Kotlin optimizes out unreachable bytecode like if (false) so if a usage of a dependency is inside of that block, DAGP considers it unused and will remove it. Removing it causes a compilation failure.
To Reproduce Steps to reproduce the behavior:
- In the attached project,
:app:fixDependenciesremoves the dependency on:utils - Running
:app:assemblewill have a compilation error because the dependency was removed
Expected behavior
The :utils dependency should not be removed by fixDependencies and should be reported in build health as being used.