Repository navigation
Create oshi-common module; annotations and most API classes - #3130
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@oshi-common/src/main/java/oshi/hardware/package-info.java`:
- Around line 2-7: Update the package-info header to match the new module name
and current year: in package-info.java change the copyright year range from
"2016-2022" to "2016-2026" (or current year) and change the Javadoc tag
"[oshi-core API]" to "[oshi-common API]" so the module name matches the file
location; keep the rest of the descriptive sentence intact (CPU, Memory,
Display, Disks, Network Interfaces, Power Sources, Sensors, and USB Devices) and
leave the SPDX line unchanged.
In `@oshi-common/src/main/java/oshi/package-info.java`:
- Around line 6-7: Update the package Javadoc in package-info.java to remove the
word “implementation” and rephrase the description to reflect that oshi-common
provides shared API/common contracts (e.g., “Provides a cross-platform common
API to retrieve Operating System and Hardware information…”), ensuring the rest
of the examples (OS version, memory, CPU, disk, devices, sensors) remain
unchanged.
In `@oshi-common/src/main/java/oshi/software/os/package-info.java`:
- Around line 2-7: Update the package Javadoc and header to reflect the module
name and current year range: change the copyright line in package-info.java from
"2016-2022" to "2016-2026" and replace the Javadoc phrase "[oshi-core API]" with
"[oshi-common API]". Ensure the rest of the descriptive text ("Provides
cross-platform implementation to retrieve OS, FileSystem, and Process
information") remains unchanged and keep the SPDX-License-Identifier intact.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf761d66-a8ee-4e82-9be4-1abf12fe8fbe
📒 Files selected for processing (41)
CHANGELOG.mdoshi-common/pom.xmloshi-common/src/main/java/oshi/PlatformEnum.javaoshi-common/src/main/java/oshi/annotation/SuppressForbidden.javaoshi-common/src/main/java/oshi/annotation/concurrent/GuardedBy.javaoshi-common/src/main/java/oshi/annotation/concurrent/Immutable.javaoshi-common/src/main/java/oshi/annotation/concurrent/NotThreadSafe.javaoshi-common/src/main/java/oshi/annotation/concurrent/ThreadSafe.javaoshi-common/src/main/java/oshi/annotation/concurrent/package-info.javaoshi-common/src/main/java/oshi/annotation/package-info.javaoshi-common/src/main/java/oshi/hardware/Baseboard.javaoshi-common/src/main/java/oshi/hardware/ComputerSystem.javaoshi-common/src/main/java/oshi/hardware/Display.javaoshi-common/src/main/java/oshi/hardware/Firmware.javaoshi-common/src/main/java/oshi/hardware/GpuStats.javaoshi-common/src/main/java/oshi/hardware/GpuTicks.javaoshi-common/src/main/java/oshi/hardware/GraphicsCard.javaoshi-common/src/main/java/oshi/hardware/LogicalVolumeGroup.javaoshi-common/src/main/java/oshi/hardware/NetworkIF.javaoshi-common/src/main/java/oshi/hardware/PowerSource.javaoshi-common/src/main/java/oshi/hardware/Printer.javaoshi-common/src/main/java/oshi/hardware/Sensors.javaoshi-common/src/main/java/oshi/hardware/SoundCard.javaoshi-common/src/main/java/oshi/hardware/UsbDevice.javaoshi-common/src/main/java/oshi/hardware/VirtualMemory.javaoshi-common/src/main/java/oshi/hardware/package-info.javaoshi-common/src/main/java/oshi/package-info.javaoshi-common/src/main/java/oshi/software/os/ApplicationInfo.javaoshi-common/src/main/java/oshi/software/os/FileSystem.javaoshi-common/src/main/java/oshi/software/os/InternetProtocolStats.javaoshi-common/src/main/java/oshi/software/os/NetworkParams.javaoshi-common/src/main/java/oshi/software/os/OSDesktopWindow.javaoshi-common/src/main/java/oshi/software/os/OSFileStore.javaoshi-common/src/main/java/oshi/software/os/OSService.javaoshi-common/src/main/java/oshi/software/os/OSSession.javaoshi-common/src/main/java/oshi/software/os/package-info.javaoshi-core-java11/pom.xmloshi-core-java25/pom.xmloshi-core-java25/src/main/java/oshi/ffm/mac/MacSystem.javaoshi-core/pom.xmlpom.xml
📜 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). (6)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, macos-latest
- GitHub Check: Test JDK 25, windows-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 11, macos-latest
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
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.
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, 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: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:46.910Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3117
File: oshi-core-java25/src/main/java/oshi/hardware/platform/linux/LinuxPowerSourceFFM.java:62-65
Timestamp: 2026-04-05T05:40:43.357Z
Learning: In OSHI's Linux FFM and JNA udev code, a null guard on `udev_enumerate_new()` is intentionally absent and should not be flagged. This is consistent across all four FFM classes (LinuxPowerSourceFFM, LinuxHWDiskStoreFFM, LinuxLogicalVolumeGroupFFM, LinuxUsbDeviceFFM) and the JNA implementation (which also does not guard `enumerateNew()` for null). Per libudev semantics, `udev_enumerate_new()` only returns NULL when udev itself is broken (e.g. OOM), so a successful `udev_new()` (which is guarded) implies `udev_enumerate_new()` will succeed. Adding a null guard would be both redundant and inconsistent with the established pattern.
📚 Learning: 2026-04-05T15:37:16.042Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3117
File: oshi-core-java25/src/main/java/oshi/hardware/platform/linux/LinuxUsbDeviceFFM.java:59-65
Timestamp: 2026-04-05T15:37:16.042Z
Learning: In OSHI's Linux USB device implementations (LinuxUsbDeviceFFM, and the JNA equivalent), when `getUsbDevices(boolean tree)` is called with `tree=false`, the returned flat list intentionally **includes** controller nodes — it does not exclude them. The existing Javadoc that says "returns a flat list excluding controllers" is incorrect. Do not flag the implementation for including controllers in flat mode; instead, flag only the Javadoc if it claims controllers are excluded.
Applied to files:
oshi-common/src/main/java/oshi/hardware/UsbDevice.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, 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/UsbDevice.javaoshi-common/src/main/java/oshi/software/os/FileSystem.javaoshi-common/src/main/java/oshi/software/os/NetworkParams.javaoshi-common/src/main/java/oshi/hardware/LogicalVolumeGroup.javaoshi-common/src/main/java/oshi/software/os/ApplicationInfo.javaoshi-common/src/main/java/oshi/hardware/Display.javaoshi-common/src/main/java/oshi/hardware/Firmware.javaoshi-common/src/main/java/oshi/hardware/SoundCard.javaoshi-common/src/main/java/oshi/software/os/OSService.javaoshi-common/src/main/java/oshi/hardware/ComputerSystem.javaoshi-common/src/main/java/oshi/hardware/Baseboard.javaoshi-common/src/main/java/oshi/hardware/VirtualMemory.javaoshi-common/src/main/java/oshi/hardware/PowerSource.javaoshi-common/src/main/java/oshi/software/os/InternetProtocolStats.javaoshi-common/src/main/java/oshi/annotation/SuppressForbidden.javaoshi-core-java11/pom.xmloshi-common/src/main/java/oshi/hardware/NetworkIF.javaoshi-common/src/main/java/oshi/hardware/Sensors.javaoshi-common/src/main/java/oshi/software/os/OSSession.javaoshi-common/src/main/java/oshi/package-info.javaoshi-common/src/main/java/oshi/hardware/package-info.javaoshi-common/src/main/java/oshi/software/os/package-info.javaoshi-common/src/main/java/oshi/PlatformEnum.javaoshi-common/src/main/java/oshi/software/os/OSDesktopWindow.javaoshi-core-java25/pom.xmlCHANGELOG.mdoshi-core/pom.xmloshi-common/pom.xml
📚 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-common/src/main/java/oshi/hardware/UsbDevice.javaoshi-common/src/main/java/oshi/software/os/FileSystem.javaoshi-common/src/main/java/oshi/software/os/NetworkParams.javaoshi-common/src/main/java/oshi/hardware/LogicalVolumeGroup.javaoshi-common/src/main/java/oshi/software/os/ApplicationInfo.javaoshi-common/src/main/java/oshi/hardware/Display.javaoshi-common/src/main/java/oshi/hardware/Firmware.javaoshi-common/src/main/java/oshi/hardware/SoundCard.javaoshi-common/src/main/java/oshi/software/os/OSService.javaoshi-common/src/main/java/oshi/hardware/ComputerSystem.javaoshi-common/src/main/java/oshi/hardware/Baseboard.javaoshi-common/src/main/java/oshi/hardware/VirtualMemory.javaoshi-common/src/main/java/oshi/hardware/PowerSource.javaoshi-common/src/main/java/oshi/software/os/InternetProtocolStats.javaoshi-common/src/main/java/oshi/annotation/SuppressForbidden.javaoshi-core-java11/pom.xmloshi-common/src/main/java/oshi/hardware/NetworkIF.javaoshi-common/src/main/java/oshi/hardware/Sensors.javaoshi-common/src/main/java/oshi/software/os/OSSession.javaoshi-common/src/main/java/oshi/package-info.javaoshi-common/src/main/java/oshi/hardware/package-info.javaoshi-common/src/main/java/oshi/software/os/package-info.javaoshi-core-java25/pom.xmlCHANGELOG.mdoshi-core/pom.xmloshi-common/pom.xmlpom.xml
📚 Learning: 2026-04-05T16:15:03.230Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3117
File: oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxLogicalVolumeGroupJNA.java:95-97
Timestamp: 2026-04-05T16:15:03.230Z
Learning: In `LinuxLogicalVolumeGroupJNA.getLogicalVolumeGroups()` (oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxLogicalVolumeGroupJNA.java), `physicalVolumesMap.get(e.getKey())` in the final stream mapping cannot return null: both `logicalVolumesMap` and `physicalVolumesMap` are populated via `computeIfAbsent` inside the same conditional block (`!Util.isBlank(vgName) && !Util.isBlank(lvName)`), so every VG key in `logicalVolumesMap` is guaranteed to have a corresponding entry in `physicalVolumesMap`. Do not flag this `.get()` call as a potential null-return issue. The FFM version uses `getOrDefault` as extra defensiveness, not because null is possible here.
Applied to files:
oshi-common/src/main/java/oshi/hardware/LogicalVolumeGroup.java
📚 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: 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/PowerSource.javaoshi-common/src/main/java/oshi/hardware/package-info.java
📚 Learning: 2026-04-03T18:43:50.370Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:99-100
Timestamp: 2026-04-03T18:43:50.370Z
Learning: In oshi/oshi PlatformEnum.java, the DragonFly BSD detection uses `osName.equalsIgnoreCase("dragonflybsd")` intentionally, mirroring the exact same check in JNA's `Platform.java` source. Java's `os.name` property on DragonFly BSD is "dragonflybsd" (no space), so `startsWith("DragonFly")` is NOT the correct pattern here. Do not suggest changing it to `startsWith`.
Applied to files:
oshi-common/src/main/java/oshi/software/os/package-info.javaoshi-common/src/main/java/oshi/PlatformEnum.java
📚 Learning: 2026-04-03T18:44:46.910Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:46.910Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.
Applied to files:
oshi-common/src/main/java/oshi/PlatformEnum.java
📚 Learning: 2026-04-08T17:30:08.833Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3127
File: CHANGELOG.md:3-3
Timestamp: 2026-04-08T17:30:08.833Z
Learning: In the oshi/oshi repository's `CHANGELOG.md`, the standard layout uses `#` (h1) for release version headers and `#####` (h5) for subsection headers such as "New Features" and "Bug fixes / Improvements". This intentional heading level skip is the project's established convention and should not be flagged as a markdownlint MD001 violation.
Applied to files:
CHANGELOG.md
🔇 Additional comments (32)
oshi-common/src/main/java/oshi/software/os/FileSystem.java (1)
2-2: Header year update looks good.This is a non-functional metadata update and does not affect API behavior or compatibility.
oshi-common/src/main/java/oshi/hardware/SoundCard.java (1)
2-2: Header year-range update looks good.Non-functional metadata change only; no API/behavior impact.
oshi-common/src/main/java/oshi/annotation/concurrent/Immutable.java (1)
2-2: LGTM! Copyright year updated appropriately.The copyright year range has been correctly updated to reflect the current year.
oshi-common/src/main/java/oshi/hardware/Display.java (1)
2-2: LGTM! Copyright year updated.The copyright year range has been appropriately updated to reflect the current year.
oshi-common/src/main/java/oshi/annotation/concurrent/NotThreadSafe.java (1)
2-2: Header-only change looks good.Copyright year update is non-functional and safe.
oshi-common/src/main/java/oshi/annotation/SuppressForbidden.java (1)
2-2: LGTM — non-functional metadata update only.No functional/API changes introduced.
oshi-common/src/main/java/oshi/hardware/LogicalVolumeGroup.java (1)
2-2: Looks good — documentation header refresh only.No code-path, contract, or API surface changes.
oshi-common/src/main/java/oshi/hardware/ComputerSystem.java (1)
2-2: Approved.This is a harmless copyright-year update.
oshi-common/src/main/java/oshi/hardware/Sensors.java (1)
2-2: LGTM.Header year bump only; no implementation/API risk.
oshi-common/src/main/java/oshi/hardware/Firmware.java (1)
2-2: No concerns here.Change is documentation metadata only.
oshi-common/src/main/java/oshi/hardware/VirtualMemory.java (1)
2-2: Approved — safe header update.No logic or API changes detected.
oshi-common/src/main/java/oshi/annotation/concurrent/GuardedBy.java (1)
2-2: Looks good.Header year-range update is clean and non-breaking.
oshi-common/src/main/java/oshi/software/os/OSService.java (1)
2-2: Header-only change looks good.Line 2 is a non-functional copyright update and aligns with the module migration work.
oshi-common/src/main/java/oshi/software/os/InternetProtocolStats.java (1)
2-2: No issues here.Line 2 is a metadata/header update only.
oshi-common/src/main/java/oshi/software/os/OSSession.java (1)
2-2: LGTM.Line 2 is a straightforward non-functional header refresh.
oshi-common/src/main/java/oshi/hardware/Baseboard.java (1)
2-2: Looks good.Line 2 is a harmless header update.
oshi-common/src/main/java/oshi/software/os/OSDesktopWindow.java (2)
2-2: Header update is fine.Line 2 is non-functional and consistent.
39-40: Javadoc adjustment is appropriate.Line 39 improves wording and keeps the Windows handle guidance usable without introducing a code dependency in this class.
oshi-common/src/main/java/oshi/hardware/NetworkIF.java (1)
2-2: All good on this segment.Line 2 is a non-functional header refresh only.
oshi-common/src/main/java/oshi/software/os/ApplicationInfo.java (1)
2-2: Header update looks good.No functional or API-impacting change here; this is a clean metadata-only update.
oshi-common/src/main/java/oshi/software/os/NetworkParams.java (1)
2-2: LGTM on header-year update.Purely non-functional change.
oshi-common/src/main/java/oshi/annotation/concurrent/ThreadSafe.java (1)
2-2: Looks good.Header-only update with no code impact.
oshi-common/src/main/java/oshi/hardware/UsbDevice.java (1)
2-2: Header update is clean.No behavioral change introduced.
oshi-common/src/main/java/oshi/hardware/PowerSource.java (1)
2-2: No concerns on this change.Metadata-only update, functionally safe.
CHANGELOG.md (1)
4-4: Changelog entry is accurate and well-formatted.This clearly captures the module split intent and matches the existing release-note style.
oshi-core-java11/pom.xml (1)
43-47: Dependency addition looks correct.Adding
com.github.oshi:oshi-commonhere is the right wiring for the new shared JNA-free API module.oshi-core-java25/src/main/java/oshi/ffm/mac/MacSystem.java (1)
7-7: Import reorder is fine.No functional change introduced.
pom.xml (1)
45-45: Reactor ordering is correct for the new shared module.Adding
oshi-commonat Line 45 beforeoshi-corealigns build order with the new dependency flow.oshi-core-java25/pom.xml (1)
28-32: Dependency wiring tooshi-commonlooks correct.This addition matches the API extraction and keeps
oshi-core-java25aligned with the new module layout.oshi-common/src/main/java/oshi/PlatformEnum.java (1)
122-126: Javadoc clarification is accurate and useful.The updated wording clearly documents the ordinal contract against
Platform.getOSType()return values.Also applies to: 133-137
oshi-core/pom.xml (1)
34-38:oshi-coredependency onoshi-commonis correctly added.This is the expected linkage for moved public API types and keeps module boundaries consistent.
oshi-common/pom.xml (1)
1-59: Newoshi-commonmodule POM is well-structured.Artifact metadata, minimal dependencies, and
Automatic-Module-Nameare set appropriately for the extracted common API module.
6d8a337 to
508d1db
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3130 +/- ##
==========================================
+ Coverage 66.32% 67.50% +1.17%
==========================================
Files 37 37
Lines 2034 2034
Branches 340 340
==========================================
+ Hits 1349 1373 +24
+ Misses 567 541 -26
- Partials 118 120 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
interfaces - New oshi-common Maven module with no JNA/FFM dependencies (JDK 8 compatible) - Moved annotations (SuppressForbidden, concurrent) and JNA-free hardware/OS interfaces from oshi-core to oshi-common - oshi-core, oshi-core-java11, oshi-core-java25 depend on oshi-common - oshi-core-java11 and oshi-core-java25 patch in oshi-common sources via build-helper-maven-plugin to avoid JPMS split-package issues (temporary, remove once FFM transition is complete) - Added native-forbidden-apis.txt banning JNA, FFM, and native library loading from oshi-common; enforced via forbiddenapis plugin in oshi-common/pom.xml - Spotless target/ exclusion added to prevent stale jacoco.xml failures
There was a problem hiding this comment.
🧹 Nitpick comments (1)
oshi-core-java11/pom.xml (1)
127-127: Consider adding a TODO comment for consistency withoshi-core-java25.The
oshi-core-java25/pom.xmlincludes a clarifying comment explaining this dual-inclusion pattern is temporary:<!-- TODO: Remove oshi-core and oshi-common source paths once FFM transition is complete -->Adding a similar comment here would help future maintainers understand this is intentional for JPMS constraints and not permanent.
📝 Suggested documentation addition
<configuration> <sources> + <!-- Copy source files from oshi-core and oshi-common --> + <!-- TODO: Remove oshi-core and oshi-common source paths once FFM transition is complete --> <source>${oshi.core.basedir}/src/main/java</source> <source>${oshi.common.basedir}/src/main/java</source>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@oshi-core-java11/pom.xml` at line 127, Add a TODO comment adjacent to the <source>${oshi.common.basedir}/src/main/java</source> entry in the pom.xml mirroring the note in oshi-core-java25 (e.g., "TODO: Remove oshi-core and oshi-common source paths once FFM transition is complete") so maintainers know this dual-inclusion is intentional and temporary due to JPMS/FFM constraints; update the pom.xml near that <source> element (and any sibling <source> entries) to include the clarifying comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@oshi-core-java11/pom.xml`:
- Line 127: Add a TODO comment adjacent to the
<source>${oshi.common.basedir}/src/main/java</source> entry in the pom.xml
mirroring the note in oshi-core-java25 (e.g., "TODO: Remove oshi-core and
oshi-common source paths once FFM transition is complete") so maintainers know
this dual-inclusion is intentional and temporary due to JPMS/FFM constraints;
update the pom.xml near that <source> element (and any sibling <source> entries)
to include the clarifying comment.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2832edfc-b3a7-42aa-903a-40c79a1f0622
📒 Files selected for processing (44)
.github/workflows/linux.yaml.github/workflows/pr.yamlCHANGELOG.mdconfig/native-forbidden-apis.txtoshi-common/pom.xmloshi-common/src/main/java/oshi/PlatformEnum.javaoshi-common/src/main/java/oshi/annotation/SuppressForbidden.javaoshi-common/src/main/java/oshi/annotation/concurrent/GuardedBy.javaoshi-common/src/main/java/oshi/annotation/concurrent/Immutable.javaoshi-common/src/main/java/oshi/annotation/concurrent/NotThreadSafe.javaoshi-common/src/main/java/oshi/annotation/concurrent/ThreadSafe.javaoshi-common/src/main/java/oshi/annotation/concurrent/package-info.javaoshi-common/src/main/java/oshi/annotation/package-info.javaoshi-common/src/main/java/oshi/hardware/Baseboard.javaoshi-common/src/main/java/oshi/hardware/ComputerSystem.javaoshi-common/src/main/java/oshi/hardware/Display.javaoshi-common/src/main/java/oshi/hardware/Firmware.javaoshi-common/src/main/java/oshi/hardware/GpuStats.javaoshi-common/src/main/java/oshi/hardware/GpuTicks.javaoshi-common/src/main/java/oshi/hardware/GraphicsCard.javaoshi-common/src/main/java/oshi/hardware/LogicalVolumeGroup.javaoshi-common/src/main/java/oshi/hardware/NetworkIF.javaoshi-common/src/main/java/oshi/hardware/PowerSource.javaoshi-common/src/main/java/oshi/hardware/Printer.javaoshi-common/src/main/java/oshi/hardware/Sensors.javaoshi-common/src/main/java/oshi/hardware/SoundCard.javaoshi-common/src/main/java/oshi/hardware/UsbDevice.javaoshi-common/src/main/java/oshi/hardware/VirtualMemory.javaoshi-common/src/main/java/oshi/hardware/package-info.javaoshi-common/src/main/java/oshi/package-info.javaoshi-common/src/main/java/oshi/software/os/ApplicationInfo.javaoshi-common/src/main/java/oshi/software/os/FileSystem.javaoshi-common/src/main/java/oshi/software/os/InternetProtocolStats.javaoshi-common/src/main/java/oshi/software/os/NetworkParams.javaoshi-common/src/main/java/oshi/software/os/OSDesktopWindow.javaoshi-common/src/main/java/oshi/software/os/OSFileStore.javaoshi-common/src/main/java/oshi/software/os/OSService.javaoshi-common/src/main/java/oshi/software/os/OSSession.javaoshi-common/src/main/java/oshi/software/os/package-info.javaoshi-core-java11/pom.xmloshi-core-java25/pom.xmloshi-core-java25/src/main/java/oshi/ffm/mac/MacSystem.javaoshi-core/pom.xmlpom.xml
✅ Files skipped from review due to trivial changes (32)
- oshi-common/src/main/java/oshi/hardware/Display.java
- oshi-common/src/main/java/oshi/annotation/concurrent/Immutable.java
- oshi-common/src/main/java/oshi/hardware/NetworkIF.java
- oshi-common/src/main/java/oshi/hardware/ComputerSystem.java
- oshi-common/src/main/java/oshi/annotation/concurrent/NotThreadSafe.java
- oshi-common/src/main/java/oshi/hardware/PowerSource.java
- oshi-common/src/main/java/oshi/hardware/Firmware.java
- oshi-common/src/main/java/oshi/software/os/FileSystem.java
- oshi-common/src/main/java/oshi/hardware/Sensors.java
- oshi-common/src/main/java/oshi/annotation/concurrent/GuardedBy.java
- oshi-common/src/main/java/oshi/annotation/concurrent/ThreadSafe.java
- oshi-common/src/main/java/oshi/hardware/UsbDevice.java
- oshi-common/src/main/java/oshi/software/os/NetworkParams.java
- oshi-common/src/main/java/oshi/software/os/ApplicationInfo.java
- oshi-common/src/main/java/oshi/software/os/OSSession.java
- oshi-common/src/main/java/oshi/annotation/SuppressForbidden.java
- oshi-common/src/main/java/oshi/hardware/VirtualMemory.java
- oshi-common/src/main/java/oshi/software/os/OSService.java
- oshi-common/src/main/java/oshi/hardware/Baseboard.java
- oshi-common/src/main/java/oshi/software/os/InternetProtocolStats.java
- oshi-core-java25/src/main/java/oshi/ffm/mac/MacSystem.java
- oshi-common/src/main/java/oshi/hardware/SoundCard.java
- oshi-common/src/main/java/oshi/hardware/package-info.java
- oshi-common/src/main/java/oshi/software/os/OSDesktopWindow.java
- oshi-common/src/main/java/oshi/package-info.java
- oshi-core/pom.xml
- oshi-common/src/main/java/oshi/hardware/LogicalVolumeGroup.java
- oshi-common/src/main/java/oshi/software/os/package-info.java
- CHANGELOG.md
- config/native-forbidden-apis.txt
- oshi-common/pom.xml
- oshi-common/src/main/java/oshi/PlatformEnum.java
🚧 Files skipped from review as they are similar to previous changes (3)
- .github/workflows/pr.yaml
- .github/workflows/linux.yaml
- oshi-core-java25/pom.xml
📜 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). (8)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, windows-latest
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 25, macos-latest
- GitHub Check: Test JDK 11, windows-latest
- GitHub Check: Test JDK 11, macos-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
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.
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.
📚 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-core-java11/pom.xmlpom.xml
📚 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-java11/pom.xmlpom.xml
🔇 Additional comments (6)
oshi-core-java11/pom.xml (4)
20-20: LGTM!Property definition follows the established pattern from
oshi.core.basedir.
44-48: LGTM!Dependency declaration is correct and follows the same pattern used in
oshi-core/pom.xml.
150-150: LGTM!The javadoc sourcepath correctly includes all three source directories needed for complete documentation generation.
162-162: LGTM!Reporting configuration mirrors the build configuration, maintaining consistency.
pom.xml (2)
45-45: LGTM!Correctly positions
oshi-commonas the first module in the reactor, ensuring it builds before dependent modules (oshi-core, etc.).
475-491: LGTM!Adding
**/target/**excludes to both format blocks prevents spotless from attempting to format generated/build artifacts, which is the correct behavior.
Introduces a new
oshi-commonMaven module containing only classes with zero native dependencies, making them available to future FFM-only consumers without pulling in JNA.Changes
New module:
oshi-commonslf4j-apiand standard JavaAutomatic-Module-Name: com.github.oshi.commonoshi-core) and as adependency of
oshi-core,oshi-core-java11, andoshi-core-java25Moved from
oshi-core→oshi-common(no API changes)oshi.PlatformEnumoshi.annotation.SuppressForbiddenoshi.annotation.concurrent—GuardedBy,Immutable,NotThreadSafe,ThreadSafeoshi.hardwareinterfaces —Baseboard,ComputerSystem,Display,Firmware,GraphicsCard,GpuStats,GpuTicks,LogicalVolumeGroup,NetworkIF,PowerSource,Printer,Sensors,SoundCard,UsbDevice,VirtualMemoryoshi.software.osinterfaces/classes —ApplicationInfo,FileSystem,InternetProtocolStats,NetworkParams,OSDesktopWindow,OSFileStore,OSService,OSSessionStayed in
oshi-core(deferred — have JNA or cross-module deps)CentralProcessor,HWDiskStore,GlobalMemory,HWPartition,PhysicalMemory,HardwareAbstractionLayer— util/JNA deps in default method implementationsOperatingSystem,OSProcess,OSThread— driver references or sharedStateenumJPMS Split Module Challenge
oshi-core-java11andoshi-core-java25can't reference the same package as inoshi-commonbecause they have module descriptors, so we can't (yet) userequires com.github.oshi.common. For now we are still just adding the source folders of these projects to a singular build. Once we complete migration, the java11 module will go away and the ffm module will no longer useoshi-coresource.oshi-coreis not modular so is free to use the same package.from oshi-common; enforced via forbiddenapis plugin in oshi-common/pom.xml
Next step (next PR in the series):
Summary by CodeRabbit
New Features
Chores
Bug Fixes