Fix incompatible (int) cast on boxed Double in Quick Start code#82
Merged
Fix incompatible (int) cast on boxed Double in Quick Start code#82
(int) cast on boxed Double in Quick Start code#82Conversation
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/51184227-fc7a-4a39-9032-b9b3da932569 Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix failing GitHub Actions workflow for smoke test
Fix incompatible Apr 20, 2026
(int) cast on boxed Double in Quick Start code
edburns
approved these changes
Apr 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a JDK 25 compilation failure in the repository’s Quick Start examples by updating how usage metrics (boxed Double values) are converted to integers for display.
Changes:
- Replace illegal
(int)casts onDoublevalues with.intValue()forcurrentTokens(),tokenLimit(), andmessagesLength()in example code. - Apply the same fix consistently in both the README Quick Start snippet and the JBang example.
Show a summary per file
| File | Description |
|---|---|
jbang-example.java |
Updates usage-metrics printing to use Double.intValue() instead of an invalid cast. |
README.md |
Updates the Quick Start snippet to use Double.intValue() for usage metrics, fixing compilation on newer JDKs. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
The smoke test CI job (JDK 25) was failing because the Quick Start code casts
Double(boxed) return values fromSessionUsageInfoEventDatausing(int), which only works for primitivedouble.Changes
README.md/jbang-example.java: Replace illegal(int)casts with.intValue()on the threeSessionUsageInfoEventDataaccessors (currentTokens(),tokenLimit(),messagesLength()):Pull request checklist
mvn spotless:applyhas been run to format the codemvn clean verifypasses locallyDoes this introduce a breaking change?