SONARJAVA-6488 Implement new rule S8908: Methods annotated with @CacheResult should not return void#5687
SONARJAVA-6488 Implement new rule S8908: Methods annotated with @CacheResult should not return void#5687romainbrenguier wants to merge 4 commits into
Conversation
de1cfd6 to
7ad2462
Compare
66b324a to
2509f1b
Compare
This rule detects methods annotated with @CacheResult that return void. Since void methods have no return value to cache, applying @CacheResult to them is meaningless and indicates a misunderstanding of how caching works.
a983d5c to
2022e5b
Compare
Code Review ✅ Approved 6 resolved / 6 findingsImplements rule S8908 to detect ✅ 6 resolved✅ Bug: isNormalizationCall fails to recognize the "/{2,}" pattern
✅ Quality: Accidentally committed local dev-tooling config files
✅ Edge Case: S8899 flags String.equals as a path security check (FP risk)
✅ Bug: quarkus-cache dependency missing; sample won't compile & test fails
✅ Bug: Test adds non-existent quarkus-cache jar via bare relative path
...and 1 more resolved from earlier reviews OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|




Summary
@CacheResultannotation used on void methodsChanges
New Rule: S8908
Detects methods annotated with
@CacheResultthat return void. Since void methods have no return value to cache, applying@CacheResultto them is meaningless and indicates a misunderstanding of how caching works.Rule details:
Implementation:
QuarkusCacheResultOnVoidMethodCheckto detect the patternS8899 Updates
Test plan
🤖 Generated with Claude Code
Summary by Gitar
QuarkusCacheResultOnVoidMethodCheckand added corresponding metadata, documentation, and test cases.build.ymlto explicitly select Java 26 for the autoscan job.AutoScanTestto support conditional community edition testing and refactored orchestrator creation.diff_S8908.jsonand updatedautoscan-diff-by-rules.jsonto reflect changes in integration testing baselines.This will update automatically on new commits.