autonomousapps / autonomousapps/dependency-analysis-gradle-plugin
A type used as type parameter in a generic return type is not considered public API
- Dominant language
- Kotlin
- Stars
- 2.2k
- Forks
- 158
- Avg merge
- 16h 25m
- Merged PRs (30d)
- 46
Description
**Build scan link**
Reproducer instead [return-type-generic.zip](https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/files/6591134/return-type-generic.zip)
**Plugin version**
0.73.1-SNAPSHOT
**Gradle version**
7.0
**Android Gradle Plugin (AGP) version**
n/a
**Describe the bug**
I've got an interface like this:
```
interface CoachSettingsStateMachine {
fun get(): Observable>
}
```
The `ApiResult` class is coming from a different project, which is currently declared as an `api` dependency (in the sample project from above it's coming from the rootProject).
I'm getting the advice to change the dependency from api to implementation:
```
Advice for project :settings
Existing dependencies which should be modified to be as indicated:
- implementation(project(":")) (was api)
```
I guess this generally makes sense because of type erasure, but consumers `CoachSettingsStateMachine` still need `ApiResult` to use it, so I'd consider it part of the public API.
**To Reproduce**
Steps to reproduce the behavior:
1. Run `buildHealth` on the sample project
**Expected behavior**
I'd expect no advice to be given in the sample project as said above, but I could also understand if this is working as intended
Contributor guide
Research direction
Start with the linked return-type-generic.zip reproducer and run buildHealth using the stated plugin and Gradle versions. Trace how the generic return type in CoachSettingsStateMachine is analyzed, then verify that the dependency providing ApiResult is not incorrectly advised to change from api to implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100