Skip to content

Replace wildcard SDK imports with explicit imports in docs and examples#28

Merged
edburns merged 5 commits intomainfrom
copilot/doc-update-explicit-imports
Mar 25, 2026
Merged

Replace wildcard SDK imports with explicit imports in docs and examples#28
edburns merged 5 commits intomainfrom
copilot/doc-update-explicit-imports

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

All documentation code samples and jbang-example.java used wildcard imports (import com.github.copilot.sdk.*, events.*, json.*). Each block now imports only the specific classes it uses.

Changes

  • 11 files updated: README.md, jbang-example.java, and 9 markdown files under src/site/markdown/ (including all 5 cookbook recipes, getting-started.md, index.md, documentation.md, hooks.md)
  • Each code block's wildcard imports replaced with the exact classes referenced in that snippet

Before:

import com.github.copilot.sdk.*;
import com.github.copilot.sdk.events.*;
import com.github.copilot.sdk.json.*;

After (example from error-handling.md):

import com.github.copilot.sdk.CopilotClient;
import com.github.copilot.sdk.events.AssistantMessageEvent;
import com.github.copilot.sdk.json.MessageOptions;
import com.github.copilot.sdk.json.PermissionHandler;
import com.github.copilot.sdk.json.SessionConfig;

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • mvn spotless:apply has been run to format the code
  • mvn clean verify passes locally

Does this introduce a breaking change?

  • Yes
  • No


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI linked an issue Mar 25, 2026 that may be closed by this pull request
1 task
…nd example files

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/e64d87ca-6bc9-49cb-9074-2ad5864ff11f
Copilot AI changed the title [WIP] Update imports to prefer explicit imports in error-handling.md Replace wildcard SDK imports with explicit imports in docs and examples Mar 25, 2026
Copilot AI requested a review from brunoborges March 25, 2026 14:03
@brunoborges brunoborges marked this pull request as ready for review March 25, 2026 15:14
Copilot AI review requested due to automatic review settings March 25, 2026 15:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the documentation and runnable JBang example to replace wildcard com.github.copilot.sdk.*, events.*, and json.* imports with explicit class imports, making each snippet’s dependencies clearer and more copy/paste-friendly.

Changes:

  • Replaced wildcard SDK imports with explicit imports across docs code blocks.
  • Updated jbang-example.java to use explicit SDK imports.
  • Kept examples functionally the same while clarifying referenced SDK types.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/site/markdown/index.md Updates the quick example and JBang snippet to use explicit SDK imports.
src/site/markdown/hooks.md Updates the complete hooks example to use explicit SDK imports.
src/site/markdown/getting-started.md Updates multiple tutorial snippets to use explicit SDK imports.
src/site/markdown/documentation.md Updates the basic usage snippet to use explicit SDK imports.
src/site/markdown/cookbook/pr-visualization.md Updates the cookbook example imports to explicit SDK imports.
src/site/markdown/cookbook/persisting-sessions.md Updates cookbook snippets to explicit SDK imports.
src/site/markdown/cookbook/multiple-sessions.md Updates cookbook example imports to explicit SDK imports.
src/site/markdown/cookbook/managing-local-files.md Updates cookbook example imports to explicit SDK imports.
src/site/markdown/cookbook/error-handling.md Updates multiple error-handling snippets to explicit SDK imports.
jbang-example.java Replaces wildcard SDK imports with explicit imports in the runnable example.
README.md Replaces wildcard SDK imports with explicit imports in the quick start snippet.

brunoborges and others added 3 commits March 25, 2026 12:48
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Your branch is up to date with 'upstream/copilot/doc-update-explicit-imports'.
modified:   src/site/markdown/cookbook/pr-visualization.md
modified:   src/site/markdown/getting-started.md

All 3 classes (`PRVisualization`, `ToolExample`, `WeatherAssistant`) compiled cleanly with `BUILD SUCCESS`. The explicit imports are correct.

Signed-off-by: Ed Burns <edburns@microsoft.com>
@edburns edburns merged commit 9bf1119 into main Mar 25, 2026
7 checks passed
@edburns edburns deleted the copilot/doc-update-explicit-imports branch March 25, 2026 20:46
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.

[DOCS]: In general typically prefer explicit imports

4 participants