Repository navigation
Align remaining JNA/FFM/native-free backend divergences - #3480
Conversation
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (15)
📝 WalkthroughWalkthroughThe changes refine Linux disk-type detection and update Windows native integrations for PDH retries, COM handling, network-stat fallbacks, architecture detection, wider device-property reads, and release notes. ChangesLinux disk detection
Windows FFM query handling
Windows FFM platform behavior
Windows device-tree reading
Release notes
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant queryCounters
participant collectQueryDataWithRetry
participant PdhCollectQueryData
queryCounters->>collectQueryDataWithRetry: collect query data
collectQueryDataWithRetry->>PdhCollectQueryData: call collection
PdhCollectQueryData-->>collectQueryDataWithRetry: return PDH_NO_DATA or status
collectQueryDataWithRetry->>PdhCollectQueryData: retry with exponential backoff
collectQueryDataWithRetry-->>queryCounters: enforce successful collection
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@oshi-core-ffm/src/main/java/oshi/software/os/windows/WindowsInternetProtocolStatsFFM.java`:
- Around line 43-64: Update getTCPv4Stats, getTCPv6Stats, getUDPv4Stats, and
getUDPv6Stats to handle null results from the IPHlpAPIUtilFFM calls, returning
the corresponding ZERO_TCP_STATS or ZERO_UDP_STATS fallback and preserving error
logging instead of propagating null.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b4cdd814-7b8c-4a82-907d-df92b1c7f4bb
📒 Files selected for processing (7)
oshi-common/src/main/java/oshi/hardware/common/platform/linux/nativefree/LinuxHWDiskStoreNF.javaoshi-core-ffm/src/main/java/oshi/ffm/platform/windows/PdhFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/windows/WindowsInternetProtocolStatsFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/windows/WindowsOperatingSystemFFM.javaoshi-core/src/main/java/oshi/driver/windows/DeviceTree.java
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.
Applied to files:
oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.javaoshi-core/src/main/java/oshi/driver/windows/DeviceTree.javaoshi-core-ffm/src/main/java/oshi/ffm/platform/windows/PdhFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/windows/WindowsOperatingSystemFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.javaoshi-common/src/main/java/oshi/hardware/common/platform/linux/nativefree/LinuxHWDiskStoreNF.javaoshi-core-ffm/src/main/java/oshi/software/os/windows/WindowsInternetProtocolStatsFFM.java
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/linux/nativefree/LinuxHWDiskStoreNF.java
🔇 Additional comments (10)
oshi-core/src/main/java/oshi/driver/windows/DeviceTree.java (1)
2-2: LGTM!Also applies to: 72-75
oshi-core-ffm/src/main/java/oshi/ffm/platform/windows/PdhFFM.java (1)
23-23: LGTM!oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/PerfDataUtilFFM.java (4)
16-16: LGTM!
111-112: LGTM!
147-158: LGTM!
341-342: LGTM!oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/WmiQueryHandlerFFM.java (2)
136-139: LGTM!
311-314: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/linux/nativefree/LinuxHWDiskStoreNF.java (1)
62-62: LGTM!Also applies to: 100-119
oshi-core-ffm/src/main/java/oshi/software/os/windows/WindowsOperatingSystemFFM.java (1)
457-468: LGTM!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3480 +/- ##
============================================
- Coverage 75.14% 68.73% -6.41%
Complexity 76 76
============================================
Files 589 589
Lines 21532 21553 +21
Branches 3606 3615 +9
============================================
- Hits 16180 14815 -1365
- Misses 3385 4949 +1564
+ Partials 1967 1789 -178
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:
|
Final sweep of JNA↔FFM (and native-free) backend divergences found in the consistency audit, ahead of 7.4.1. Each fix aligns a backend to the correct behavior of its twin; every commit is one fix.
Native-free Linux
LinuxHWDiskStoreNFdisk type. The native-free backend only readqueue/rotational(HDD/SSD) and left everything else"". Now mirrors the udev-based backends'detectDiskType: readsremovable(→Removable), then rotational (→SSD/HDD), elseUnknown.Windows — default (JNA) backend
DeviceTreebuffer truncation.MAX_PATHis a character count but the CM registry properties are UTF-16; the buffer was allocated asMAX_PATHbytes, truncating device friendly-names/descriptions/manufacturer strings longer than ~130 characters. Now allocatesMAX_PATH * 2bytes, matching the FFM backend.Windows — FFM backend
WmiQueryHandlerFFMgave up when COM was already initialized.initCOM()returns false onRPC_E_CHANGED_MODE(another module alreadyCoInitializeEx'd a different apartment model) — COM is still usable, but FFM early-returned an empty result. Now it proceeds with the query like the JNA backend, and only uninitializes COM it actually initialized.WindowsInternetProtocolStatsFFMreturnednullon a failed stats query, where the JNA backend returns a zeroedTcpStats/UdpStats. Callers don't null-check, so this was an NPE risk. Now returns a zeroed object.isCurrentX86used thePROCESSOR_ARCHITECTUREenv var, which reflects the process (WOW64) architecture — a 32-bit JVM on 64-bit Windows would misreport the OS and all processes as 32-bit. Now callsGetNativeSystemInfo(the true machine architecture), matching the JNA backend.PerfDataUtilFFMdidn't retry the first-sample PDH race. The JNA backend retriesPdhCollectQueryDataup to 3× with exponential backoff onPDH_NO_DATA; FFM collected once and returned empty counters. Now retries to match.Summary by CodeRabbit
New Features
Bug Fixes