Skip to content

Move PerfmonConstants, WindowsPowerSource, and WindowsOSFileStore to oshi-common - #3143

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:win-oshi-common-setup
Apr 12, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:win-oshi-common-setup

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Apr 12, 2026 •

Copy link
Copy Markdown
Member

Sets up the three Windows packages in oshi-common by migrating one class into each:

New packages in oshi-common

  • oshi.driver.common.windows.perfmon — Windows driver constants
  • oshi.hardware.common.platform.windows — Windows hardware base classes
  • oshi.software.common.os.windows — Windows software base classes

Moved classes

PerfmonConstants → oshi.driver.common.windows.perfmon

  • Constants changed from package-private to public for cross-module access
  • All perfmon driver callers and test updated to new import path

WindowsPowerSource → oshi.hardware.common.platform.windows

  • Already an abstract superclass; clean move with no code changes
  • WindowsPowerSourceJNA and WindowsPowerSourceFFM updated with new import

WindowsOSFileStore → oshi.software.common.os.windows (extracted superclass)

  • Created abstract superclass with shared fields, constructor, getters, and updateFrom() helper
  • Renamed existing to WindowsOSFileStoreJNA with updateAttributes() calling WindowsFileSystem
  • Updated WindowsOSFileStoreFFM to extend common superclass, fixed constructor parameter order to match JNA, and fixed updateAttributes() logic to use isLocal() check instead of fallback
  • WindowsFileSystem updated to instantiate WindowsOSFileStoreJNA
  • WindowsFileSystemFFM updated for new constructor signature

Build fix

  • Added !oshi.driver.common.* and !oshi.software.common.* exclusions to bnd Export-Package in oshi-core-java25 to prevent JPMS split-package errors during the shared source tree transition (TODO added for removal)

Summary by CodeRabbit

Release Notes

  • Chores
    • Reorganized internal Windows component architecture to improve code maintainability and support multiple implementation strategies.
    • Consolidated Windows-specific performance monitoring, hardware, and OS information handling into shared common modules.

@coderabbitai

coderabbitai Bot commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 54b7027f-a29d-4eea-9e91-f1da98d8a276

📥 Commits

Reviewing files that changed from the base of the PR and between 062e611 and fa80897.

📒 Files selected for processing (24)
  • CHANGELOG.md
  • oshi-common/src/main/java/module-info.java
  • oshi-common/src/main/java/oshi/driver/common/windows/perfmon/PerfmonConstants.java
  • oshi-common/src/main/java/oshi/driver/common/windows/perfmon/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsPowerSource.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/package-info.java
  • oshi-common/src/main/java/oshi/software/common/os/windows/WindowsOSFileStore.java
  • oshi-common/src/main/java/oshi/software/common/os/windows/package-info.java
  • oshi-core-java25/pom.xml
  • oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java
  • oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsFileSystemFFM.java
  • oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsOSFileStoreFFM.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/MemoryInformation.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/PagingFile.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/PerfmonConstants.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/PhysicalDisk.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessInformation.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessorInformation.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/SystemInformation.java
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/ThreadInformation.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsFileSystem.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSFileStoreJNA.java
  • oshi-core/src/test/java/oshi/driver/windows/perfmon/PerfmonDriversTest.java
💤 Files with no reviewable changes (1)
  • oshi-core/src/main/java/oshi/driver/windows/perfmon/PerfmonConstants.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). (10)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, windows-latest
  • GitHub Check: Test JDK 11, windows-latest
  • GitHub Check: Test JDK 11, macos-latest
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 25, ubuntu-latest
  • GitHub Check: Test JDK 25, macos-latest
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
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:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3125
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java:131-133
Timestamp: 2026-04-08T00:58:10.736Z
Learning: In `oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java` and `oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java`, the `getPowerSources()` method intentionally returns a singleton list wrapping a single `getPowerSource("System Battery")` call, and the enumeration loop short-circuits after the first eligible battery pack. This matches the longstanding JNA behavior and is not a bug. A broader refactor to support zero-or-more batteries across both implementations is planned for a later date. Do not flag this as an issue.
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
📚 Learning: 2026-04-08T00:58:07.212Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3125
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java:131-133
Timestamp: 2026-04-08T00:58:07.212Z
Learning: Do not flag `getPowerSources()` as incorrect when it returns a singleton list that wraps `getPowerSource("System Battery")` and/or short-circuits the enumeration after the first eligible battery pack in the Windows power source JNA/FFM implementations. This is intentional for longstanding JNA behavior; a refactor to support zero-or-more batteries is planned later, so the current single-battery behavior should be treated as by-design rather than a bug.

Applied to files:

  • oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java
  • oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.

Applied to files:

  • oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsPowerSource.java
  • oshi-common/src/main/java/oshi/software/common/os/windows/package-info.java
  • oshi-common/src/main/java/oshi/driver/common/windows/perfmon/package-info.java
  • oshi-common/src/main/java/module-info.java
  • oshi-core-java25/pom.xml
📚 Learning: 2026-04-03T02:07:47.621Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3110
File: oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java:119-121
Timestamp: 2026-04-03T02:07:47.621Z
Learning: In OSHI’s Java FFM/API implementation classes (e.g., *FFM.java) that implement/override `updateAttributes()`, preserve the intentional failure-handling pattern: catch `Throwable` and return `false` without logging. `updateAttributes()` is a public API whose contract is to signal failure via the boolean return value, and callers rely on that return value (so emitting logs from this path is not desired and should not be introduced during review unless the method contract changes).

Applied to files:

  • oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java
  • oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsFileSystemFFM.java
  • oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsOSFileStoreFFM.java
📚 Learning: 2026-04-06T04:45:51.516Z
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:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsPowerSource.java
  • oshi-common/src/main/java/oshi/software/common/os/windows/package-info.java
  • CHANGELOG.md
  • oshi-common/src/main/java/oshi/driver/common/windows/perfmon/package-info.java
  • oshi-common/src/main/java/module-info.java
  • oshi-core-java25/pom.xml
  • oshi-common/src/main/java/oshi/software/common/os/windows/WindowsOSFileStore.java
📚 Learning: 2026-04-08T00:58:10.736Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3125
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java:131-133
Timestamp: 2026-04-08T00:58:10.736Z
Learning: In `oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java` and `oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java`, the `getPowerSources()` method intentionally returns a singleton list wrapping a single `getPowerSource("System Battery")` call, and the enumeration loop short-circuits after the first eligible battery pack. This matches the longstanding JNA behavior and is not a bug. A broader refactor to support zero-or-more batteries across both implementations is planned for a later date. Do not flag this as an issue.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsPowerSource.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsFileSystem.java
📚 Learning: 2026-03-29T20:03:00.830Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java25/src/main/java/oshi/util/platform/windows/PdhUtilFFM.java:87-89
Timestamp: 2026-03-29T20:03:00.830Z
Learning: In the OSHI FFM codebase (oshi-core-java25), all PDH/Kernel32/COM wrapper methods in classes like PdhFFM, Kernel32FFM, etc. declare `throws Throwable` solely as a compiler artifact of `MethodHandle.invokeExact`. They are native calls and do not throw Java checked exceptions in practice. The enclosing `getOpenFileDescriptors()` method in PdhUtilFFM already has an outer `catch (Throwable t)` that covers the entire method body including any `finally` blocks, so no exception-masking concern exists for cleanup calls like `PdhCloseQuery` in `finally`.

Applied to files:

  • oshi-core/src/main/java/oshi/driver/windows/perfmon/ThreadInformation.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsFileSystem.java
  • oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsFileSystemFFM.java
📚 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/windows/WindowsPowerSourceJNA.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsFileSystem.java
  • oshi-core/src/main/java/oshi/software/os/windows/WindowsOSFileStoreJNA.java
🔇 Additional comments (23)
oshi-core-java25/pom.xml (1)

79-83: Scoped transition exclusions look correct.

The added Export-Package exclusions are consistent with the ongoing shared-source-tree migration and avoid exporting overlapping common packages from this module.

oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java (1)

58-58: Superclass import relocation is correct.

This import update matches the moved WindowsPowerSource base class and keeps the inheritance chain consistent.

oshi-core/src/test/java/oshi/driver/windows/perfmon/PerfmonDriversTest.java (1)

2-2: Perfmon constants migration in tests is consistent.

All updated static imports correctly target the new shared constants package.

Also applies to: 10-29

CHANGELOG.md (1)

19-19: Changelog entry is accurate and well-scoped.

The added note clearly reflects the Windows class moves and package setup in this PR.

oshi-core/src/main/java/oshi/driver/windows/perfmon/MemoryInformation.java (1)

2-2: Import migration is correct for memory perfmon constants.

The updated static imports cleanly track the constants relocation without changing behavior.

Also applies to: 7-8

oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java (1)

27-27: JNA base-class import update is correct.

The new import path properly follows the WindowsPowerSource relocation into oshi-common.

oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessInformation.java (1)

7-10: Process perfmon constants were migrated cleanly.

These import updates align with the shared constants package move and preserve current behavior.

oshi-common/src/main/java/oshi/hardware/common/platform/windows/package-info.java (1)

1-8: Package-level documentation addition looks good.

The new package-info.java clearly documents the shared Windows hardware common package purpose.

oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessorInformation.java (1)

7-11: Static import migration looks correct.

The constants were repointed to the shared oshi-common package and usage remains unchanged in query paths.

oshi-core/src/main/java/oshi/driver/windows/perfmon/PagingFile.java (1)

7-8: Import update is clean and behavior-preserving.

PAGING_FILE and WIN32_PERF_RAW_DATA_PERF_OS_PAGING_FILE are now sourced from the shared constants package with no logic drift.

oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsPowerSource.java (1)

5-5: Superclass package move is correctly applied.

The relocation to oshi.hardware.common.platform.windows is consistent with sharing this base between JNA and FFM implementations.

oshi-core/src/main/java/oshi/driver/windows/perfmon/PhysicalDisk.java (1)

7-8: Perfmon constant repointing looks good.

No behavior changes introduced; only the constants source was moved to the shared package as intended.

oshi-common/src/main/java/oshi/software/common/os/windows/package-info.java (1)

5-8: Package-level docs are clear and aligned with the refactor.

The Javadoc correctly describes this package as shared Windows OS implementation support for JNA/FFM.

oshi-core/src/main/java/oshi/driver/windows/perfmon/ThreadInformation.java (1)

7-10: Thread perfmon import migration is consistent.

All relevant constants now come from oshi.driver.common.windows.perfmon.PerfmonConstants with no functional change in query behavior.

oshi-common/src/main/java/oshi/driver/common/windows/perfmon/package-info.java (1)

5-8: Good addition of package-level documentation.

The description matches the new role of this package as the shared location for Windows perfmon constants.

oshi-core/src/main/java/oshi/driver/windows/perfmon/SystemInformation.java (1)

7-8: System perfmon constants migration is correct.

The file cleanly points to the new shared constants package without changing runtime behavior.

oshi-core/src/main/java/oshi/software/os/windows/WindowsFileSystem.java (1)

125-129: LGTM!

The instantiation sites are correctly updated to use WindowsOSFileStoreJNA instead of the now-abstract WindowsOSFileStore. Constructor parameter ordering matches the new class signature consistently across all three locations.

Also applies to: 196-198, 241-243

oshi-common/src/main/java/module-info.java (1)

8-8: LGTM!

The new exports correctly expose the relocated Windows-specific packages for cross-module access by oshi-core and oshi-core-java25.

Also applies to: 13-13, 16-16

oshi-core/src/main/java/oshi/software/os/windows/WindowsOSFileStoreJNA.java (1)

1-45: LGTM!

The JNA implementation correctly:

  • Extends the abstract WindowsOSFileStore from oshi-common
  • Delegates all constructor parameters to the superclass
  • Implements updateAttributes() with proper local vs. WMI branching based on isLocal()
  • Uses the inherited updateFrom() helper for field updates
  • Guards against short mount strings with the length check before substring(0, 2)
oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsFileSystemFFM.java (1)

123-127: LGTM!

The constructor calls are correctly updated to match the new WindowsOSFileStoreFFM signature. Parameter ordering is consistent with the parent class constructor: name, volume, label, mount, options, uuid, local (boolean), logicalVolume, description, fsType, freeSpace, usableSpace, totalSpace, freeInodes, totalInodes.

The type != 4 check in getWmiVolumes correctly identifies local drives (type 4 is DRIVE_REMOTE).

Also applies to: 219-221, 296-298

oshi-common/src/main/java/oshi/software/common/os/windows/WindowsOSFileStore.java (1)

5-5: LGTM!

The refactoring correctly:

  • Moves the class to the common package for shared access
  • Makes it abstract to enforce concrete JNA/FFM implementations
  • Restricts the constructor to protected visibility
  • Provides updateFrom() helper that updates only the mutable state fields (space, inodes, description, fsType, logicalVolume), leaving identity fields (name, volume, mount, etc.) unchanged as expected

Also applies to: 12-15, 27-29, 81-95

oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsOSFileStoreFFM.java (1)

9-44: LGTM!

The FFM implementation correctly:

  • Extends the abstract WindowsOSFileStore from oshi-common
  • Mirrors the JNA implementation's updateAttributes() logic for consistency
  • Uses isLocal() to branch between local and WMI volume lookups
  • Calls the inherited updateFrom() helper on match
  • Returns false without logging on failure, preserving the established FFM failure-handling pattern
oshi-common/src/main/java/oshi/driver/common/windows/perfmon/PerfmonConstants.java (1)

1-55: LGTM!

The PerfmonConstants utility class is well-structured:

  • public final class with private constructor prevents instantiation
  • @ThreadSafe annotation is appropriate for an immutable constants class
  • All constants are public static final for cross-module access
  • WMI query fragments and table names are correctly defined

📝 Walkthrough

Walkthrough

This PR relocates Windows-specific classes to oshi-common for shared use between JNA and FFM implementations. PerfmonConstants, WindowsPowerSource, and WindowsOSFileStore are moved to common packages. WindowsOSFileStore is refactored to an abstract base class with concrete JNA and FFM subclasses. All consumer imports are updated to reference new locations.

Changes

Cohort / File(s) Summary
Module Infrastructure
oshi-common/src/main/java/module-info.java, oshi-core-java25/pom.xml
Updated module exports and OSGi package exclusions to support Windows driver, hardware, and software packages being relocated to oshi-common with temporary exclusion comments during JPMS transition.
PerfmonConstants Migration
oshi-common/src/main/java/oshi/driver/common/windows/perfmon/PerfmonConstants.java, oshi-common/src/main/java/oshi/driver/common/windows/perfmon/package-info.java, oshi-core/src/main/java/oshi/driver/windows/perfmon/PerfmonConstants.java
Relocated PerfmonConstants from oshi-core driver package to oshi-common driver package with new package documentation; original class deleted from oshi-core.
PerfmonConstants Import Updates
oshi-core/src/main/java/oshi/driver/windows/perfmon/MemoryInformation.java, oshi-core/src/main/java/oshi/driver/windows/perfmon/PagingFile.java, oshi-core/src/main/java/oshi/driver/windows/perfmon/PhysicalDisk.java, oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessInformation.java, oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessorInformation.java, oshi-core/src/main/java/oshi/driver/windows/perfmon/SystemInformation.java, oshi-core/src/main/java/oshi/driver/windows/perfmon/ThreadInformation.java, oshi-core/src/test/java/oshi/driver/windows/perfmon/PerfmonDriversTest.java
Updated static imports to reference PerfmonConstants from oshi-common instead of oshi-core; copyright year ranges updated to 2020-2026.
WindowsPowerSource Relocation
oshi-common/src/main/java/oshi/hardware/common/platform/windows/WindowsPowerSource.java, oshi-common/src/main/java/oshi/hardware/common/platform/windows/package-info.java, oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java, oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java
Moved WindowsPowerSource to oshi-common hardware package; both JNA and FFM implementations updated to import and extend the common base class.
WindowsOSFileStore Abstraction & Refactoring
oshi-common/src/main/java/oshi/software/common/os/windows/WindowsOSFileStore.java, oshi-common/src/main/java/oshi/software/common/os/windows/package-info.java
Relocated WindowsOSFileStore to oshi-common and refactored from concrete to abstract class; constructor made protected; removed overridden updateAttributes(); added protected updateFrom() helper for field propagation.
WindowsOSFileStoreJNA Implementation
oshi-core/src/main/java/oshi/software/os/windows/WindowsOSFileStoreJNA.java, oshi-core/src/main/java/oshi/software/os/windows/WindowsFileSystem.java
New concrete JNA implementation extending abstract WindowsOSFileStore with updateAttributes() override; FileSystem updated to instantiate WindowsOSFileStoreJNA instead of WindowsOSFileStore.
WindowsOSFileStoreFFM Refactoring
oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsOSFileStoreFFM.java, oshi-core-java25/src/main/java/oshi/software/os/windows/WindowsFileSystemFFM.java
Refactored FFM implementation to extend abstract WindowsOSFileStore; removed duplicate fields; reordered constructor parameters (moved local earlier); updated calls to use new parameter order and updateFrom() helper.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 Constants hopped from core to common ground,
🏠 Building shared foundations all around!
📦 Abstract paths for JNA and FFM to see,
Windows harmonized, now happily free! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: relocating three Windows-related classes (PerfmonConstants, WindowsPowerSource, WindowsOSFileStore) into the oshi-common module with new package structures.

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

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

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 Apr 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.30%. Comparing base (062e611) to head (fa80897).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3143      +/-   ##
============================================
+ Coverage     61.91%   62.30%   +0.38%     
  Complexity       12       12              
============================================
  Files            39       39              
  Lines          2329     2329              
  Branches        407      407              
============================================
+ Hits           1442     1451       +9     
+ Misses          777      769       -8     
+ Partials        110      109       -1     

☔ View full report in Codecov by Sentry.
📢 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