Repository navigation
Sonar java8-era modernization sweep (S1602, S1611, S1612, S8694) - #3394
Conversation
Three FFM cleanup/downcall lambdas had a redundant '{ ... }' (and one a
redundant 'return'); convert them to expression lambdas. No behavior change.
Four single-parameter lambdas in LinuxSensors used parenthesized parameters ((s), (index), (files)); remove the parentheses. No behavior change.
Replace two lambdas that simply forward their argument with method references: Ole32FFM.CoUninitialize (runOrLog) and AuxvTest's NativeLongReader. The remaining S1612 findings (the assertDoesNotThrow call sites) are left as lambdas on purpose: a method reference there is ambiguous between the Executable and ThrowingSupplier overloads of assertDoesNotThrow, so the lambda is required to compile.
Replace numeric month arguments in LocalDate.of/LocalDateTime.of test literals with the corresponding java.time.Month constants for readability. No behavior change.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2026-04-12T19:22:09.716ZApplied to files:
🔇 Additional comments (8)
📝 WalkthroughWalkthroughThis PR refactors code style across multiple modules by simplifying lambda expressions and modernizing date construction in tests. Changes include removing redundant lambda parameter parentheses, converting lambdas to method references, and replacing numeric month literals with Month enum constants. No functional behavior is altered. ChangesCode Style Modernization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3394 +/- ##
============================================
+ Coverage 68.65% 75.02% +6.37%
Complexity 76 76
============================================
Files 579 579
Lines 21363 21363
Branches 3560 3560
============================================
+ Hits 14666 16027 +1361
+ Misses 4868 3308 -1560
- Partials 1829 2028 +199
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Follow-up to #3393, covering the mechanical
java8-tagged SonarCloud findings. One commit per rule. No behavior change; verified locally with a cleaninstall -P aggregate-coverage,native-comparison(full unit suite + NativeComparisonTest green) plus checkstyle/forbiddenapis/javadoc on the touched modules.Applied
{ ... }(one also a redundantreturn) collapsed to expression form.LinuxSensorssingle-parameter lambdas had parenthesized params; parentheses removed.Ole32FFM::CoUninitializeviarunOrLog, andAuxvTest'sNativeLongReader).LocalDate.of/LocalDateTime.oftest literals replaced withjava.time.Monthconstants.Intentionally left (false positives in context)
assertDoesNotThrow(...)call sites inDmidecodeTest,LshalTest,CpuInfoTest) — a method reference there is ambiguous between theExecutableandThrowingSupplier<T>overloads ofassertDoesNotThrow; the lambda is required to compile.WindowsInternetProtocolStatsJNA× 4,MacHWDiskStoreFFM× 1) — the JNA sites reassignbufinside the buffer-grow loop (not effectively final), and the Mac site's outertrywraps a borrowed-singletonCFAllocatorRef(@SuppressWarnings("resource")) that must not be closed. Neither converts to try-with-resources without changing behavior.SolarisComputerSystem) — the guard is!containsKey(k) || isBlank(get(k)), i.e. it also replaces blank values;computeIfAbsentonly fires when the key is absent, so the suggestion would change behavior.ProcessorPaneldemo) — thejava.util.Dateis required by JFreeChart'snew Second(Date)constructor.I'll mark the false-positive findings as won't-fix in SonarCloud separately.
Summary by CodeRabbit
Refactor
Tests