refactor: use Optional return types instead of nullable boxed primitives in public API#189
Draft
Copilot wants to merge 3 commits into
Draft
refactor: use Optional return types instead of nullable boxed primitives in public API#189Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…ves in public API Change getter return types from nullable Boolean/Integer/Double to Optional<Boolean>/OptionalInt/OptionalDouble on all mutable config/builder classes. Setters now take primitive parameters. Add clearXxx() methods for resetting to null (server default). Add @JsonIgnore on Optional-returning getters to preserve Jackson serialization. Update all callers and tests. Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update public API to use Optional return types
refactor: use Optional return types instead of nullable boxed primitives in public API
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #30
Before the change?
Boolean,Integer,Double) — a C# idiom carried over from the reference implementation. The "may be absent" contract is invisible in type signatures and forgotten null-checks compile fine but NPE at runtime.After the change?
Optional<Boolean>,OptionalInt, orOptionalDouble. Setters take primitives (boolean,int,double). NewclearXxx()methods reset tonull(server default).@JsonIgnoreon Optional-returning getters prevents Jackson from attempting to serializeOptionalwrappers.OptionalAPIs:Affected classes (15):
CopilotClientOptions,SessionConfig,ResumeSessionConfig,InfiniteSessionConfig,InputOptions,ModelCapabilitiesOverride.Supports,ModelCapabilitiesOverride.Limits,ProviderConfig,TelemetryConfig,SessionUiCapabilities,CustomAgentConfig,UserInputRequestCreateSessionRequest,ResumeSessionRequest,McpServerConfig,ModelLimitsUpdated callers:
CliServerManager,CopilotClient,CopilotSession,SessionRequestBuilderNot changed: Records, generated code under
src/generated/java/, primitive fields that were already non-nullable.Pull request checklist
mvn spotless:applyhas been run to format the codemvn clean verifypasses locallyDoes this introduce a breaking change?
Getter return types change from
Boolean/Integer/Double→Optional<Boolean>/OptionalInt/OptionalDouble. Setter parameter types change from boxed → primitive. Callers passingnullto setters must use the newclearXxx()methods instead.