-
Notifications
You must be signed in to change notification settings - Fork 901
Removed @Nullable
annotation to maintain binary compatibility with 1.49.0
for Kotlin users
#7359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
api/all/src/main/java/io/opentelemetry/api/common/AttributesBuilder.java
Outdated
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:
|
@@ -110,7 +110,7 @@ public void end(long timestamp, TimeUnit unit) { | |||
} | |||
|
|||
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! We should release a patch to fix this.
Let me know when y'all plan to merge this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@Nullable
and 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.
Closing since I haven't heard any strong strong push back against my comment |
This reverts PR #7271, thereby addressing #7358, which broke binary compatibility in for Kotlin users in release
1.50.0