google / google/ksp

Duplicate JetBrains annotations on classpath for symbol-processing-aa consumers

Open
#3,152 1 comment 0 reactions 0 assignees View on GitHub
build enhancement P3
Dominant language
Kotlin
Stars
3.5k
Forks
415
Avg merge
1d 2h
Merged PRs (30d)
53

Description

[Dependency Analysis Gradle Plugin](https://github.com/autonomousapps/dependency-analysis-gradle-plugin) reports duplicate classes on the classpath for consumers of `symbol-processing-aa`:

```
Warnings
Some of your classpaths have duplicate classes, which means the compile and runtime behavior can be sensitive to the classpath order.

Source set: main
\--- compile classpath
+--- org/jetbrains/annotations/NotNull is provided by multiple dependencies: [com.google.devtools.ksp:symbol-processing-aa:2.3.11, org.jetbrains:annotations:13.0]
\--- org/jetbrains/annotations/Nullable is provided by multiple dependencies: [com.google.devtools.ksp:symbol-processing-aa:2.3.11, org.jetbrains:annotations:13.0]
\--- runtime classpath
+--- org/jetbrains/annotations/NotNull is provided by multiple dependencies: [com.google.devtools.ksp:symbol-processing-aa:2.3.11, org.jetbrains:annotations:13.0]
\--- org/jetbrains/annotations/Nullable is provided by multiple dependencies: [com.google.devtools.ksp:symbol-processing-aa:2.3.11, org.jetbrains:annotations:13.0]
```

I believe the cause is that `org.jetbrains:annotations:24.1.0` is included in the uber jar:
https://github.com/google/ksp/blob/19f2608cec0d82a75879e36ebdddbaaaa0ada84f/kotlin-analysis-api/build.gradle.kts#L185

While there's also a dependency chain from `symbol-processing-aa` > `symbol-processing-api` > `kotlin-stdlib` > `annotations 13.0`.

Contributor guide

Open the contributing guide

Research direction

Start in kotlin-analysis-api/build.gradle.kts around line 185, where org.jetbrains:annotations:24.1.0 is included in the uber jar. Trace that packaging alongside the symbol-processing-aa > symbol-processing-api > kotlin-stdlib dependency chain. Done means consumers no longer receive duplicate NotNull and Nullable classes; verify with the Dependency Analysis Gradle Plugin report described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.