fix(types): restore LLMProvider source compatibility for the 7-arg primitive shape#151
Merged
Merged
Conversation
…imitive shape Code-review finding on PR #148: the new 13-arg boxed constructor replaced the public 7-arg primitive shape, and getPriority() / getWeight() changed from `int` to `Integer`. That's a real breaking change in a PR framed as additive — pre-existing callers either fail to compile (constructor) or now see nullable return values where they expected primitives (accessors). This PR preserves source compatibility while keeping the boxed storage that the wire-shape contract needs: 1. Add a 7-arg primitive constructor that delegates to the new 13-arg one with nulls for the post-PR-#148 optional fields. Marked @deprecated to nudge new callers toward the boxed form. 2. getPriority() and getWeight() return primitive `int` again (null-safe-unbox to 0). Boxed access is via the new getPriorityBoxed() / getWeightBoxed() methods. 3. getEnabled() (which was BRAND NEW in PR #148, returning Boolean) is renamed to getEnabledBoxed() so the JavaBeans-style name doesn't lure callers into `boolean e = p.getEnabled()` and an NPE on null. Pre-PR-#148 had no getEnabled() so this rename has no consumers. 4. Same Boxed-suffix pattern applied to getHasApiKey → getHasApiKeyBoxed for symmetry; primitive `boolean hasApiKey()` was already there from before #148. Two new regression tests pin the source-compat shape: - llmProviderLegacyConstructorPreservesSourceCompat — exercises the 7-arg primitive constructor and confirms primitive-returning accessors round-trip correctly. - llmProviderPrimitiveAccessorsNullSafe — confirms primitive accessors null-safe-unbox to 0 / false when the boxed field is null (which is what Jackson produces when the JSON field is omitted). Existing test that asserted on `p.getEnabled()` updated to `p.getEnabledBoxed()` to match the new naming. Wire-shape baseline refreshed — the renamed getter is not part of the wire contract (Jackson reads via constructor), but the validator records SDK class shape and noticed the rename. No spec drift.
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.
Summary
Code-review finding on PR #148: the new 13-arg boxed constructor replaced the public 7-arg primitive shape, and `getPriority()` / `getWeight()` changed from `int` to `Integer`. That's a real breaking change in a PR framed as additive — pre-existing callers either fail to compile (constructor) or now see nullable return values where they expected primitives (accessors).
This PR preserves source compatibility while keeping the boxed storage that the wire-shape contract needs.
What changed
Test plan
New tests
Why this matters now
This lands BEFORE Java SDK v6.2.0 is tagged, so PR #148's source-incompat shape never reaches a published Maven Central release. Consumers upgrading from v6.1.0 → v6.2.0 won't see any breaking change.