Commit 16727a6
authored
fix(java-runtime): org.jetbrains:annotations leaks onto consumers' runtime classpath (#5136)
The `jsii-runtime` Maven artifact declared `org.jetbrains:annotations` at the default `compile` scope. Because `compile` dependencies are transitive, the annotations jar was exposed to everything that depends on `jsii-runtime`.
It does not belong on the runtime classpath at all. The runtime only uses `@Nullable` and `@VisibleForTesting`, which have CLASS and SOURCE retention respectively. They carry no runtime behavior, the JVM does not need the annotation classes present to load classes that reference them, and nothing in the runtime reflects on them at runtime (the only annotation-driven behavior reads jsii's own `software.amazon.jsii.Jsii` annotation). They are purely a compile-time concern for IDEs and static analysis.
This changes the dependency to `provided` scope so it remains available for the runtime's own compilation and tests but is no longer propagated to anything that depends on the runtime. The full `yarn build` was run: all 33 sources compile and the 14 tests pass.
---
By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].
[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.01 parent e14cd30 commit 16727a6
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
0 commit comments