Skip to content
Prev Previous commit
Next Next commit
Address code review feedback: use assertFalse, simplify README
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/e74714e4-bb84-4af7-b1ef-44f576c5b37c

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
  • Loading branch information
Copilot and brunoborges authored Apr 7, 2026
commit ce4fd3d7b0983cce5a6a5af1b85c899703ffa081
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Java SDK for programmatic control of GitHub Copilot CLI, enabling you to build A

### Requirements

- Java 17 or later. **JDK 21+ recommended** for automatic virtual thread support (see [Virtual Threads](#virtual-threads) below). Selecting JDK 25 additionally enables the use of virtual threads for the custom executor, as shown in the [Quick Start](#quick-start).
- Java 17 or later. **JDK 21+ recommended** — the SDK automatically uses virtual threads for its internal I/O on Java 21+ (see [Virtual Threads](#virtual-threads)).
Comment thread
brunoborges marked this conversation as resolved.
Outdated
- GitHub Copilot CLI 1.0.17 or later installed and in `PATH` (or provide custom `cliPath`)

### Maven
Expand Down Expand Up @@ -69,23 +69,17 @@ implementation 'com.github:copilot-sdk-java:0.2.1-java.1'
import com.github.copilot.sdk.CopilotClient;
import com.github.copilot.sdk.events.AssistantMessageEvent;
import com.github.copilot.sdk.events.SessionUsageInfoEvent;
import com.github.copilot.sdk.json.CopilotClientOptions;
import com.github.copilot.sdk.json.MessageOptions;
import com.github.copilot.sdk.json.PermissionHandler;
import com.github.copilot.sdk.json.SessionConfig;

import java.util.concurrent.Executors;

public class CopilotSDK {
public static void main(String[] args) throws Exception {
var lastMessage = new String[]{null};

// Create and start client
try (var client = new CopilotClient()) { // JDK 25+: comment out this line
// JDK 25+: uncomment the following 3 lines for virtual thread support
// var options = new CopilotClientOptions()
// .setExecutor(Executors.newVirtualThreadPerTaskExecutor());
// try (var client = new CopilotClient(options)) {
// On Java 21+, the SDK automatically uses virtual threads for internal I/O.
try (var client = new CopilotClient()) {
client.start().get();

// Create a session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package com.github.copilot.sdk;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -56,7 +57,7 @@ void isVirtualThreadsReturnsBoolean() {
if (javaVersion >= 21) {
assertTrue(result, "Expected virtual threads on Java 21+");
} else {
assertTrue(!result, "Expected platform threads on Java < 21");
assertFalse(result, "Expected platform threads on Java < 21");
}
}
}
Loading