Skip to content
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

Add @Nullable annotations #744

Merged

Conversation

m15o
Copy link
Contributor

@m15o m15o commented Jun 11, 2024

  • Added @Nullable annotations to methods and fields in micrometer-tracing-bridges directories.
  • Added @Nullable annotations to TraceContext.sampled() and Tracer.nextSpan(Span), since the documents say the functions might return `null.

Fixes #732


FinishedSpan.getKind() is not annotated with @Nullable, but its implementetion might return null. I am no sure whether the implementation or the interface was wrong, so I didn't fix it.

/**
* @return span's kind
*/
Span.Kind getKind();

public Span.Kind getKind() {
if (this.spanData.getKind() == SpanKind.INTERNAL) {
return null;

public Span.Kind getKind() {
if (this.mutableSpan.kind() == null) {
return null;

@marcingrzejszczak marcingrzejszczak added this to the 1.4.0-M1 milestone Jun 11, 2024
@marcingrzejszczak marcingrzejszczak added the type: task A general task label Jun 11, 2024
@marcingrzejszczak marcingrzejszczak merged commit bee7c5f into micrometer-metrics:main Jun 11, 2024
5 checks passed
@shakuzen shakuzen added enhancement New feature or request and removed type: task A general task labels Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@Nullable annotation is missing from methods that may return null
3 participants