Skip to content

OpenBSD: add JNA suffix to oshi-core HAL/OS/etc classes - #3363

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:openbsd-jna-suffix
Jun 9, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:openbsd-jna-suffix

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jun 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Mechanical naming-consistency cleanup. The 8 OpenBSD classes in oshi-core (5 hardware, 3 software/os) get a JNA suffix to match the convention already used for AIX (#3350), FreeBSD, and (as of #3362) DragonFly. The 6 abstract bases in oshi-common keep their unsuffixed names; the FFM classes in oshi-core-ffm already have the FFM suffix.

OpenBSD is the last Unix platform that was inconsistent on this. Solaris is the other holdout but needs architectural work (extracting common bases to oshi-common first), so it stays a separate task.

What changed

  • Renames in oshi-core/.../openbsd/:
    • OpenBsdComputerSystem → OpenBsdComputerSystemJNA
    • OpenBsdHardwareAbstractionLayer → OpenBsdHardwareAbstractionLayerJNA
    • OpenBsdCentralProcessor → OpenBsdCentralProcessorJNA
    • OpenBsdGlobalMemory → OpenBsdGlobalMemoryJNA
    • OpenBsdHWDiskStore → OpenBsdHWDiskStoreJNA
    • OpenBsdFileSystem → OpenBsdFileSystemJNA
    • OpenBsdOperatingSystem → OpenBsdOperatingSystemJNA
    • OpenBsdOSProcess → OpenBsdOSProcessJNA
  • Three classes (OpenBsdGlobalMemory, OpenBsdFileSystem, OpenBsdOSProcess) previously used extends oshi.<...>.<unqualified-same-name> to disambiguate from the common base of the same name. With the suffix in place, those become regular extends OpenBsdFoo with a normal import — cleaner and matches every other platform.
  • oshi-core/SystemInfo.java updated for the two renamed entry-point classes.
  • OpenBsdSysctlUtil stays unsuffixed in oshi-core (matches the BsdSysctlUtil precedent — the FFM counterpart OpenBsdSysctlUtilFFM carries the suffix on the FFM side only).

Test plan

  • ./mvnw clean install from repo root passes (all tests).
  • Spotless / Checkstyle / Forbidden APIs / Javadoc clean.
  • No external module references to the renamed classes besides oshi-core/SystemInfo (oshi-core-ffm/SystemInfo already references the FFM versions which kept their existing names).
  • PR CI matrix passes. OpenBSD-specific code path exercised by the OpenBSD VM job in pr.yaml.

Summary by CodeRabbit

  • Refactor
    • OpenBSD platform implementations refactored to standardize on JNA-based classes across operating system, hardware, file system, and process management components, improving internal consistency while maintaining full backward compatibility with existing public APIs.

Matches the naming convention established by AIX (#3350), FreeBSD, and
extended to DragonFly today (#3362). The 8 oshi-core OpenBSD classes
(5 hardware, 3 software/os) get a JNA suffix to make the JNA-vs-FFM
split explicit in the file names. The 6 abstract bases in oshi-common
keep their unsuffixed names; the FFM classes in oshi-core-ffm already
have the FFM suffix.

- Rename:
  - OpenBsdComputerSystem.java → OpenBsdComputerSystemJNA.java
  - OpenBsdHardwareAbstractionLayer.java → OpenBsdHardwareAbstractionLayerJNA.java
  - OpenBsdCentralProcessor.java → OpenBsdCentralProcessorJNA.java
  - OpenBsdGlobalMemory.java → OpenBsdGlobalMemoryJNA.java
  - OpenBsdHWDiskStore.java → OpenBsdHWDiskStoreJNA.java
  - OpenBsdFileSystem.java → OpenBsdFileSystemJNA.java
  - OpenBsdOperatingSystem.java → OpenBsdOperatingSystemJNA.java
  - OpenBsdOSProcess.java → OpenBsdOSProcessJNA.java
- Three classes (OpenBsdGlobalMemory, OpenBsdFileSystem, OpenBsdOSProcess)
  previously used `extends oshi.<...>.<unqualified-same-name>` to
  disambiguate from the common base of the same name. With the suffix
  in place the FQN-extends becomes a regular `extends OpenBsdFoo` with
  a normal import — cleaner and matches every other platform.
- oshi-core SystemInfo updated for the two renamed entry points.
- OpenBsdSysctlUtil stays unsuffixed in oshi-core (matches the
  BsdSysctlUtil precedent — the FFM counterpart OpenBsdSysctlUtilFFM
  carries the suffix on the FFM side only).

Tested with `./mvnw clean install` from root (all tests pass).
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8293fd12-59f2-4ff6-b968-a6628f83d6a7

📥 Commits

Reviewing files that changed from the base of the PR and between e566e02 and 92ccf2b.

📒 Files selected for processing (9)
  • oshi-core/src/main/java/oshi/SystemInfo.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystemJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdGlobalMemoryJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemJNA.java
📜 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). (16)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: JMH Benchmarks, ubuntu-latest
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: JMH Benchmarks, macos-latest
  • GitHub Check: JMH Benchmarks, windows-latest
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystemJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdGlobalMemoryJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdFileSystemJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerJNA.java
🔇 Additional comments (9)
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorJNA.java (1)

53-54: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystemJNA.java (1)

24-24: LGTM!

Also applies to: 26-26, 28-28, 30-30, 32-32

oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdGlobalMemoryJNA.java (1)

15-15: LGTM!

Also applies to: 26-26

oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreJNA.java (1)

30-30: LGTM!

Also applies to: 32-33, 35-35, 51-51, 92-92

oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerJNA.java (1)

33-33: LGTM!

Also applies to: 36-36, 40-40, 45-45, 50-50, 65-65

oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemJNA.java (1)

49-52: LGTM!

Also applies to: 56-57, 95-96, 152-153

oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdFileSystemJNA.java (1)

8-8: LGTM!

Also applies to: 16-16

oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessJNA.java (1)

38-41: LGTM!

Also applies to: 50-52, 72-73, 103-105, 388-388

oshi-core/src/main/java/oshi/SystemInfo.java (1)

19-19: LGTM!

Also applies to: 29-29, 128-128, 163-163


📝 Walkthrough

Walkthrough

This PR systematically renames OpenBSD platform implementation classes to explicitly denote JNA-backed variants. Hardware, OS, file system, and process classes gain a "JNA" suffix; the entry point in SystemInfo is updated to instantiate these new implementations while preserving all public API signatures.

Changes

OpenBSD JNA Platform Implementation

Layer / File(s) Summary
Hardware component implementations
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorJNA.java, OpenBsdComputerSystemJNA.java, OpenBsdGlobalMemoryJNA.java, OpenBsdHWDiskStoreJNA.java
OpenBsdCentralProcessorJNA, OpenBsdComputerSystemJNA, OpenBsdGlobalMemoryJNA, and OpenBsdHWDiskStoreJNA class names introduced; memoized suppliers and internal references updated to use the new class names.
Hardware abstraction layer factory
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerJNA.java
OpenBsdHardwareAbstractionLayerJNA factory methods (createComputerSystem(), createGlobalMemory(), createCentralProcessor(), getDiskStores()) switch to instantiate/return OpenBsd*JNA implementations instead of non-JNA variants.
Operating system and file system layer
oshi-core/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemJNA.java, OpenBsdFileSystemJNA.java, OpenBsdOSProcessJNA.java
OpenBsdOperatingSystemJNA now returns OpenBsdFileSystemJNA and creates OpenBsdOSProcessJNA instances. OpenBsdOSProcessJNA updated to reference OpenBsdOperatingSystemJNA in its constructor and field types, and uses OpenBsdOperatingSystemJNA.PS_COMMAND_ARGS.
SystemInfo entry point updates
oshi-core/src/main/java/oshi/SystemInfo.java
Imports and factory methods (createOperatingSystem(), createHardware()) for OpenBSD platform switch from non-JNA classes to OpenBsdOperatingSystemJNA and OpenBsdHardwareAbstractionLayerJNA.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • oshi/oshi#3333: Moves shared pure-Java OpenBSD base types (e.g., OpenBsdGlobalMemory, OpenBsdFileSystem) to oshi-common module; this PR's new JNA classes extend those shared base types.

Poem

🐰 A refactoring hop through OpenBSD land,
Where JNA classes now clearly stand,
With suffixes bright and names so clear,
The platform implementations appear!
No behavior changed, just names made right—
A maintainer's joy, a code review's light! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding JNA suffix to OpenBSD classes in oshi-core for naming consistency, which is the core focus of this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.00%. Comparing base (969b48b) to head (92ccf2b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3363      +/-   ##
============================================
+ Coverage     67.82%   75.00%   +7.18%     
  Complexity       76       76              
============================================
  Files           552      552              
  Lines         22757    22758       +1     
  Branches       3759     3759              
============================================
+ Hits          15434    17069    +1635     
+ Misses         5451     3581    -1870     
- Partials       1872     2108     +236     
Flag Coverage Δ
freebsd 25.77% <0.00%> (+<0.01%) ⬆️
linux 29.11% <0.00%> (-0.02%) ⬇️
macos 29.78% <0.00%> (+<0.01%) ⬆️
openbsd 25.19% <100.00%> (+<0.01%) ⬆️
solaris 27.49% <0.00%> (?)
windows 37.38% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant