Skip to content

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

Open
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:docs/fix-context-javadoc-examples
Open

thswlsqls wants to merge 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

Waiting on reviewers · refreshed 2026-10-13 03:26 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • 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

This branch has not been deployed

No deployments
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

1 participant