Removed @Nullable annotation to maintain binary compatibility with 1.49.0 for Kotlin users#7359
Closed
bidetofevil wants to merge 2 commits intoopen-telemetry:mainfrom
Closed
Removed @Nullable annotation to maintain binary compatibility with 1.49.0 for Kotlin users#7359bidetofevil wants to merge 2 commits intoopen-telemetry:mainfrom
@Nullable annotation to maintain binary compatibility with 1.49.0 for Kotlin users#7359bidetofevil wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
trask
reviewed
May 20, 2025
api/all/src/main/java/io/opentelemetry/api/common/AttributesBuilder.java
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7359 +/- ##
============================================
- Coverage 89.87% 89.84% -0.03%
+ Complexity 6899 6897 -2
============================================
Files 786 786
Lines 20793 20793
Branches 2026 2026
============================================
- Hits 18687 18682 -5
- Misses 1465 1468 +3
- Partials 641 643 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bidetofevil
commented
May 20, 2025
|
|
||
| @Override | ||
| public io.opentelemetry.api.trace.Span setAttribute(String key, @Nullable String value) { | ||
| public io.opentelemetry.api.trace.Span setAttribute(String key, @Nonnull String value) { |
Author
There was a problem hiding this comment.
I restored this despite it being inconsistent with the API, but I didn't want to make any additional changes on a PR that is essentially a revert.
@Nullable annotation to maintain binary compatibility with 1.49.0 for Kotlin users
jkwatson
approved these changes
May 21, 2025
Contributor
jkwatson
left a comment
There was a problem hiding this comment.
Thanks! We should release a patch to fix this.
breedx-splk
approved these changes
May 21, 2025
Author
|
Let me know when y'all plan to merge this |
jack-berg
requested changes
Jun 10, 2025
Member
jack-berg
left a comment
There was a problem hiding this comment.
I don't think we should merge this.
Reasoning:
- This doesn't affect users, only implementations of the API.
- At the otel project level, we're actually not under any obligation to ensure API implementations are not broken across releases. If we were, then interfaces would be unable to be evolved with additional methods in languages that don't have features like java's interface default implementations. In java, we do provide default implementations of interfaces as a convenience, but there's an argument that we're doing a disservice by obscuring / hiding API additions from implementations who would otherwise receive compilation errors upon upgrading.
- This change of an argument from non-null to null is an edge which seems specific to kotlin implementations of the API, and my read of VERSIONING.md is that we don't make any guarantees about this type of thing. I don't think we're obligated to patch this. I'm more open to amending the VERSIONING.md, but also am not in favor of that.
- Overall, I like that attribute values are now
@Nullableand think it meaningfully improves the API ergonomics. That harm caused by this introduction seems small and localized to kotlin implementations of the API, of which there may just be one in existence. From my perspective, the benefit exceeds the harm by quite a large margin.
Member
|
Closing since I haven't heard any strong strong push back against my comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reverts PR #7271, thereby addressing #7358, which broke binary compatibility in for Kotlin users in release
1.50.0