Skip to content

Refactor: use var for local variable type inference#31

Merged
brunoborges merged 1 commit intomainfrom
refactor/use-var-type
Feb 6, 2026
Merged

Refactor: use var for local variable type inference#31
brunoborges merged 1 commit intomainfrom
refactor/use-var-type

Conversation

@brunoborges
Copy link
Member

Summary

Apply Java var (local variable type inference) across the codebase where the type is obvious from the right-hand side expression.

Changes

3 main source files + 14 test files (17 files total)

Conversion patterns applied:

  • Constructor calls: Type x = new Type()var x = new Type()
  • Diamond operator fill: List<X> x = new ArrayList<>()var x = new ArrayList<X>()
  • Cast expressions: Type x = (Type) exprvar x = (Type) expr

Main sources:

  • CopilotClient.java — 19 local variables converted
  • CopilotSession.java — 7 local variables converted
  • JsonRpcClient.java — 8 local variables converted

Test sources:

CopilotClientTest, CopilotSessionTest, ToolsTest, SessionEventHandlingTest, SessionEventParserTest, SessionEventsE2ETest, PermissionsTest, HooksTest, CompactionTest, ErrorHandlingTest, AskUserTest, McpAndAgentsTest, CapiProxy, MetadataApiTest

Verification

  • Spotless formatting passes
  • Compilation clean (main + test)
  • All tests pass

Apply Java var (local variable type inference) across the codebase where
the type is obvious from the right-hand side expression:
- Constructor calls: Type x = new Type() -> var x = new Type()
- Diamond operator fill: List<X> x = new ArrayList<>() -> var x = new ArrayList<X>()
- Cast expressions: Type x = (Type) expr -> var x = (Type) expr

Modified 3 main source files and 14 test files (17 files total).
@brunoborges brunoborges merged commit dcce429 into main Feb 6, 2026
2 checks passed
@brunoborges brunoborges deleted the refactor/use-var-type branch February 16, 2026 15:43
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.

1 participant