Repository navigation
FFM package restructure: mirror JNA layout; refine JaCoCo excludes - #3356
Conversation
FFM driver classes are internal implementations (not exported via JPMS), and per project convention should live alongside their JNA equivalents in `oshi.driver.*` — same arrangement as the `oshi.hardware.*` / `oshi.software.os.*` namespaces. The `oshi.ffm.driver.*` location was an organic placement from the AIX (#3350) and Solaris (#3339) FFM ports; the earlier Mac/Linux/Windows FFM drivers already used `oshi.driver.*`, so this aligns the four ports under one rulebook. Moves (13 files + 2 package-info): * `oshi.ffm.driver.unix.aix.PsInfoFFM` and the 7 `oshi.ffm.driver.unix.aix.perfstat.Perfstat*FFM` drivers move to `oshi.driver.unix.aix.*`, next to the JNA `Perfstat*JNA` peers. * `oshi.ffm.driver.unix.solaris.PsInfoFFM` and `oshi.ffm.driver.unix.solaris.kstat.SystemPagesFFM` move to `oshi.driver.unix.solaris.*`. * `oshi.ffm.driver.windows.registry.InstalledAppsDataFFM` moves to `oshi.driver.windows.registry.*` next to the other Windows registry FFM drivers. No JPMS export changes — `oshi.ffm.driver.*` was never exported, and `oshi.driver.*` is also internal-only. 13 consumer files (in `oshi.hardware.platform.unix.{aix,solaris}.*`, `oshi.software.os.unix.{aix,solaris}.*`, and `oshi.software.os.windows.*`) had their imports rewritten by sed. `module-info.test` add-opens lines updated to match the new package names. First commit in a multi-commit FFM package restructure; final state ships as one PR. See [[project_ffm_structural_cleanup]] memory for the full plan.
`CupsPrinterFFM` is an implementation class (extends the abstract `CupsPrinter` from `oshi-common`), not an FFM mapping. Its JNA peer `CupsPrinterJNA` lives at `oshi.hardware.platform.unix.CupsPrinterJNA`; this move lines the two up. It was sharing `oshi.ffm.unix` with `CupsFunctions` (the actual libcups FFM mapping, which stays put). The same-package access to `CupsFunctions` becomes an explicit import. Six consumers (the `*HardwareAbstractionLayerFFM` classes on Linux, Mac, FreeBSD, OpenBSD, Solaris, and AIX) had their imports rewritten.
Mirrors the existing JNA layout (`oshi.jna.platform.<lang>.*`) so the mapping/wrapper layer lives under one clear sub-package. After this: * All FFM mapping declarations and tightly-coupled struct/constant/ exception types live under `oshi.ffm.platform.<lang>.*`. * `oshi.ffm.util.*` retains the real utility classes (unchanged). * `oshi.ffm.common.*` (NvmlFunctions) and the `oshi.ffm` root files (`SystemInfo`, `ForeignFunctions`, `NativeHandle`) stay put. This is purely a `git mv` + package/import rewrite — no behaviour changes. Counts: ~150 source files renamed, ~120 import paths rewritten across consumers and tests. `module-info.test` add-opens updated for the four renamed packages. Third commit in the FFM package restructure series; final state ships as one PR.
….solaris
`LibKstatFunctions` extends `ForeignFunctions` — it's the libkstat FFM
mapping, not a utility class. It was sitting in
`oshi.ffm.util.platform.unix.solaris.*` next to `KstatUtilFFM` (a real
utility) and `Kstat2Functions` (a probe-only stub). Move it to
`oshi.ffm.platform.unix.solaris.*` alongside the other libc mappings.
`Kstat2Functions` retains its same-package `{@link LibKstatFunctions}`
javadoc reference, now resolved through an explicit import.
After the FFM package restructure (`oshi.ffm.{linux,mac,unix,windows}.*`
→ `oshi.ffm.platform.*`, driver classes moved out, CupsPrinterFFM
moved out), the FFM mapping layer is now a clean glob target. Add an
exclude block that mirrors the JNA exclude block:
* `**/ffm/common/**` — cross-platform mappings (NvmlFunctions).
* `**/ffm/platform/**` — per-language mappings and their tightly-coupled
struct/constant/exception types.
* `**/ffm/ForeignFunctions*` — base helper (and its nested
`ArenaCallable` family of functional interfaces).
* `**/ffm/NativeHandle*` — pointer-lifetime AutoCloseable wrapper.
Util classes (`oshi.ffm.util.*`) and the public SPI entry point
(`oshi.ffm.SystemInfo`) stay in coverage by design.
Also narrows the JNA exclude — the previous `**/jna/**` pattern was a
catch-all that accidentally dropped `oshi.jna.util.*` (real utilities)
from coverage. Replaced with the same shape as the FFM block:
`**/jna/common/**`, `**/jna/platform/**`, plus the two top-level files
(`ByRef`, `Struct`) by name. `oshi.jna.util.*` is now covered.
Last commit in the FFM package restructure series; ships as one PR.
|
Important Review skippedToo many files! This PR contains 197 files, which is 47 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (197)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3356 +/- ##
============================================
- Coverage 75.01% 74.97% -0.04%
Complexity 76 76
============================================
Files 602 551 -51
Lines 25832 22750 -3082
Branches 3983 3759 -224
============================================
- Hits 19378 17057 -2321
+ Misses 4204 3584 -620
+ Partials 2250 2109 -141
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:
|
…e inline FQN CI on JDK 25/26 caught a missing import in `KstatUtilFFM` — it relied on same-package access to `LibKstatFunctions` (and used the class name directly in 6 call sites like `LibKstatFunctions.kstat_read(...)`, which the existing static-imported constants don't cover). When LibKstatFunctions moved out of `oshi.ffm.util.platform.unix.solaris` to `oshi.ffm.platform.unix.solaris`, those bare references stopped resolving. Add the explicit import. Local incremental builds passed because stale `LibKstatFunctions.class` files at the OLD package path lingered in `target/classes`; CI does clean builds and rightly rejects the file. Also folds in the deferred inline-FQN cleanup in `IOReportClientFFM.cfRelease`: `oshi.ffm.platform.mac.CoreFoundationFunctions.CFRelease(seg)` becomes a static import + `CFRelease(seg)` per project convention.
Summary
Restructures
oshi-core-ffm's package layout so the FFM mapping layer mirrors the JNA layer one-to-one. Resolves the structural mess uncovered during #3355:oshi.driver.*(Mac/Linux/Windows FFM ports) andoshi.ffm.driver.*(AIX/Solaris FFM ports). The split was an artifact of when each port landed, not by design.*Functions.javaon Mac/Linux/Unix vs*FFM.javaon Windows) made any glob-based JaCoCo exclude either over- or under-shoot.**/ffm/**exclude accidentally dropped 25 real driver classes (AIX perfstat, Solaris PsInfo, Windows InstalledApps) from coverage.The historical context: when 7.0.0 cut,
oshi.ffm.*was just the mapping layer (parallel tooshi.jna.*). 7.0.1 moved a lot of internals underoshi.ffm.*to resolve a user-reported JPMS split-package error. That fix was incomplete and uneven — this PR finishes it.Five commits, all pure
git mv+ package/import rewrites + the final JaCoCo config change. No behaviour changes.Final layout
The new layout mirrors JNA's
oshi.jna.{common,platform,util}.*exactly. As a side effect this PR also narrows the JNA exclude (the old**/jna/**catch-all was droppingoshi.jna.util.*from coverage; now those utility classes are covered too).Commit-by-commit
oshi.ffm.driver.*→oshi.driver.*— 13 driver classes (AIX perfstat, Solaris PsInfo + kstat, Windows InstalledApps) join the existing FFM drivers inoshi.driver.*for parity with the JNA driver location.CupsPrinterFFM→oshi.hardware.platform.unix.*— it's an implementation (extendsCupsPrinter), not a mapping; mirrors its JNA peer.oshi.ffm.{linux,mac,unix,windows}.*→oshi.ffm.platform.*— biggest commit, ~150 files. Mirrorsoshi.jna.platform.<lang>.*.LibKstatFunctionsout of the util tree — it extendsForeignFunctions; belongs with the other Solaris libc mappings.<excludes>— replace the broad**/ffm/**(never landed) and the broad**/jna/**with the narrow per-layer patterns.JPMS impact
None.
oshi-core-ffmexports onlyoshi.ffm.*packages —oshi.driver.*,oshi.hardware.*,oshi.software.os.*are all internal (not exported), so the existing split withoshi-core's same-named packages remains as it was. Users pick one runtime; both modules never co-load.Test plan
./mvnw -pl oshi-core,oshi-core-ffm,oshi-common,oshi-dist -am spotless:apply checkstyle:check install -DskipTests— clean to oshi-dist locally./mvnw -pl oshi-core-ffm -am test— full suite green (782 oshi-common + 68 oshi-core-ffm)