Commit 14091bf
committed
spotbugs: clear remaining Max+Low findings (DLS + SPP + RCN + Lombok USBR + getter routing)
End-to-end sweep that brings jllama to zero SpotBugs Max+Low findings.
The history audit while doing this surfaced that several earlier
"successful" suppressions were lost in past rebases and never actually
committed — this commit re-applies the canonical pattern in one place.
Five changes:
1. DLS_DEAD_LOCAL_STORE on LlamaModel.completeAsync — Option A from the
cross-repo discussion: drop the `cancelHook` local entirely, lift
`@SuppressWarnings("FutureReturnValueIgnored")` to the method. The
inline comment documents why the suppression sits at method scope
(cross-repo FireAndForget DLS reckoning).
2. SPP_FIELD_COULD_BE_STATIC on LlamaModel.ctx — narrow `<Match>` block
in spotbugs-exclude.xml with rationale: `ctx` is the per-instance
native handle, making it static would corrupt state across parallel
LlamaModel instances.
3. RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE x2 in ChatRequest.buildMessagesJson:
ChatMessage.getContent() and ToolCall.getArgumentsJson() are both
@nonnull (no @nullable annotation; NullAway proves the contract);
the `== null ? "" : ...` ternaries were dead code. Removed.
4. USBR_UNNECESSARY_STORE_BEFORE_RETURN on Lombok-generated equals /
hashCode / canEqual / toString — restore the cross-repo canonical
suppression block. Lombok injects the textbook polynomial-hash
pattern (`int result = 1; ...; return result;`) on every value
class; fb-contrib's USBR detector doesn't honour @lombok.Generated
and would otherwise fire ~18 times across the codebase. Suppression
matches the four Lombok-emitted method names; the cross-repo
rationale lives in ../workspace/policies/lombok-config.md.
5. lombok.config — restore `doNotUseGetters = true` for
@EqualsAndHashCode and @tostring. Cross-repo invariant tracked in
the workspace policy. Without it, fb-contrib
OI_OPTIONAL_ISSUES_CHECKING_REFERENCE fires on every Optional-
wrapping getter routed through Lombok's generated equals/hashCode
(ChatMessage.getParts() returns Optional<List<ContentPart>>).
Verification:
- mvn compile spotbugs:check -Dspotbugs.effort=Max -Dspotbugs.threshold=Low
→ BugInstance size is 0, BUILD SUCCESS.
- 121 tests pass across ChatRequestTest / ChatResponseTest /
InferenceParametersTest / JsonParametersTest / MultimodalMessagesTest.
Net cross-repo SpotBugs Max+Low: 0 / 0 / 0 / 0 across jllama / BAF /
plugin / streambuffer.1 parent 1b427a9 commit 14091bf
3 files changed
Lines changed: 34 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
48 | 29 | | |
49 | 30 | | |
50 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
| |||
267 | 269 | | |
268 | 270 | | |
269 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
270 | 289 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
239 | 246 | | |
240 | 247 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 248 | + | |
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
| |||
0 commit comments