-
Notifications
You must be signed in to change notification settings - Fork 958
@Nullable annotations on API broke binary compatibility in Kotlin #7358
Description
Describe the bug
In 1.50.0, #7271 broke binary compatibility for users of the Java API in Kotlin. All unannotated parameters were previously assumed to be non-null, likely due to the use of the @ParametersAreNonnullByDefault annotation in the package. This resulted in compile time failures due to the expected non-nulls (e.g. String!) becoming nullable (e.g. String?) for any implementations of the affected interfaces, like in the test failure here.
EDIT: Note that this does not impact users of the API who do not implemented any of the affected interfaces. Passing in non-null parameters will still compile fine if the underlying method has nullable ones.
Steps to reproduce
- Create a Kotlin project that depends on OTel Java API
1.49.0 - Implement
Spaninterface that compiles - Bump to dependency to
1.50.0 - Compilation fails because the implementation doesn't match the interface due to the nullability of the parameters
What did you expect to see?
I expect that as a Kotlin user of the OTel Java API, there wouldn't be compilation-breaking changes in this version bump.
What did you see instead?
Compilation failure due to binary incompatibility introduced by the annotation.
What version and what artifacts are you using?
1.50.0 of Java BoM, referencing the opentelemetry-api package, but others with similar changes are likely affected as well.
Environment
Compiler: Adopt 17.0.15+6
OS: Unbuntu 24.04.02
Additional context
Using Kotlin 2.0 with 1.8 compat (this and the OS/compiler shouldn't make a difference)