Skip to content

Commit d761586

Browse files
brunoborgesCopilot
andcommitted
refactor: Remove unnecessary executor null checks in session creation
Since executor is now guaranteed to be non-null, removed redundant null checks on lines 442 and 530 before calling session.setExecutor(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bd7cdbc commit d761586

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/main/java/com/github/copilot/sdk/CopilotClient.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,7 @@ public CompletableFuture<CopilotSession> createSession(SessionConfig config) {
439439

440440
long setupNanos = System.nanoTime();
441441
var session = new CopilotSession(sessionId, connection.rpc);
442-
if (executor != null) {
443-
session.setExecutor(executor);
444-
}
442+
session.setExecutor(executor);
445443
SessionRequestBuilder.configureSession(session, config);
446444
sessions.put(sessionId, session);
447445
LoggingHelpers.logTiming(LOG, Level.FINE,
@@ -527,9 +525,7 @@ public CompletableFuture<CopilotSession> resumeSession(String sessionId, ResumeS
527525
// Register the session before the RPC call to avoid missing early events.
528526
long setupNanos = System.nanoTime();
529527
var session = new CopilotSession(sessionId, connection.rpc);
530-
if (executor != null) {
531-
session.setExecutor(executor);
532-
}
528+
session.setExecutor(executor);
533529
SessionRequestBuilder.configureSession(session, config);
534530
sessions.put(sessionId, session);
535531
LoggingHelpers.logTiming(LOG, Level.FINE,

0 commit comments

Comments
 (0)