Skip to content

Fix uncompilable Javadoc examples in io.opentelemetry.context - #8934

Merged
jack-berg merged 1 commit into
open-telemetry:mainfrom
thswlsqls:docs/fix-context-javadoc-examples
Oct 15, 2026
Merged

jack-berg merged 1 commit into
open-telemetry:mainfrom
thswlsqls:docs/fix-context-javadoc-examples

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8931

Description

  • Context class and Context.with(ContextKey, Object) Javadoc: CRED_KEY.get() (no such method) → Context.current().get(CRED_KEY).
  • ContextKey Javadoc: static Context.with(KEY, ...) → Context.current().with(KEY, ...). ContextKey update example code #7420 renamed withValues to with but kept the static call.
  • ContextStorage Javadoc: drop the > line prefix, replace the nonexistent RequestContextStorage with ContextStorage, fix public Scope T attach, and add the missing semicolons.
  • Context.wrap(Callable) Javadoc: say Callable instead of Runnable.
  • Follows Fix javadoc examples in context propagation interfaces #8715, which fixed the same problem in io.opentelemetry.context.propagation.

Testing done

  • Docs-only: no test added, no public API change.
  • ./gradlew :context:check :context:javadoc passed.
  • Compiled the updated examples with javac --release 8 against context/build/classes/java/main (with stub helpers): all compile. The previous versions fail with cannot find symbol, non-static method ... cannot be referenced from a static context, and ';' expected.

Fix code examples in the Context, ContextKey and ContextStorage Javadoc
that do not compile when copied, and correct the wrap(Callable) Javadoc
that described a Runnable.
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-15 21:45 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.66%. Comparing base (387f5c5) to head (fda4373).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8934      +/-   ##
============================================
+ Coverage     90.65%   90.66%   +0.01%     
- Complexity    10887    10890       +3     
============================================
  Files          1015     1015              
  Lines         29731    29731              
  Branches       3876     3876              
============================================
+ Hits          26953    26957       +4     
  Misses         1860     1860              
+ Partials        918      914       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thswlsqls
thswlsqls marked this pull request as ready for review October 13, 2026 03:24
@thswlsqls
thswlsqls requested a review from a team as a code owner October 13, 2026 03:24

@breedx-splk breedx-splk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jack-berg
jack-berg merged commit 2b21722 into open-telemetry:main Oct 15, 2026
35 checks passed
@otelbot

otelbot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @thswlsqls! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

@thswlsqls
thswlsqls deleted the docs/fix-context-javadoc-examples branch October 18, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Javadoc examples in io.opentelemetry.context do not compile

4 participants