dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

Nested generic types not detected

Open SimonMarquis opened this issue 2 months ago • 1 comments

Plugin version

Latest 3.3.0

Gradle version 9.1.0

JDK version 25

(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version 2.2.21

(Optional) reason output for bugs relating to incorrect advice

./gradlew :app:reason --id ":lib"

> Task :app:reason

------------------------------------------------------------
You asked about the dependency ':lib'.
You have been advised to change this dependency to 'implementation' from 'api'.
------------------------------------------------------------

[...]

Source: main
------------
* Uses 1 class: com.example.lib.LibBox (implies implementation).

Describe the bug I would expect all nested generic types to be retained, not only the first level.

To Reproduce

// lib/LibBox.kt
class LibBox<T>(val data: T)
// app/main.kt

// Another local generic box type
class Box<T>(val data: T)

// This is OK --> api(projects.lib)
val foo: LibBox<Unit> = LibBox(Unit)

// This is KO --> You have been advised to change this dependency to 'implementation' from 'api'
val foo: Box<LibBox<Unit>> = Box(LibBox(Unit))

Link to a reproducer project: https://github.com/SimonMarquis/DAGP-1583

Generic support was initially implemented here: #723

SimonMarquis avatar Oct 24 '25 13:10 SimonMarquis

Thanks for the report.

autonomousapps avatar Oct 28 '25 22:10 autonomousapps