Repository navigation
Move ThreadInfo, MacSoundCard, and MacOSThread to oshi-common; set up macOS packages - #3144
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
✅ Files skipped from review due to trivial changes (9)
🚧 Files skipped from review as they are similar to previous changes (4)
📜 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). (11)
🧰 Additional context used🧠 Learnings (4)📓 Common learnings📚 Learning: 2026-03-29T20:01:06.452ZApplied to files:
📚 Learning: 2026-04-06T21:48:11.921ZApplied to files:
📚 Learning: 2026-04-03T02:07:47.621ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughThis PR moves three macOS-specific types (ThreadInfo, MacSoundCard, MacOSThread) into new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3144 +/- ##
============================================
- Coverage 62.00% 61.91% -0.09%
Complexity 12 12
============================================
Files 39 39
Lines 2329 2329
Branches 407 407
============================================
- Hits 1444 1442 -2
+ Misses 776 771 -5
- Partials 109 116 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/driver/common/mac/package-info.java`:
- Line 2: Update the copyright header in the package-info.java file to include
the current year range (e.g., change "Copyright (c) 2020-2022 The OSHI Project
Contributors" to "Copyright (c) 2020-2026 The OSHI Project Contributors"),
ensuring the header matches other files introduced/modified in this PR.
🪄 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: e59a8957-aea5-4f52-9eb4-c98cb0616284
📒 Files selected for processing (14)
CHANGELOG.mdconfig/checkstyle-suppressions.xmloshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/driver/common/mac/ThreadInfo.javaoshi-common/src/main/java/oshi/driver/common/mac/package-info.javaoshi-common/src/main/java/oshi/hardware/common/platform/mac/MacSoundCard.javaoshi-common/src/main/java/oshi/hardware/common/platform/mac/package-info.javaoshi-common/src/main/java/oshi/software/common/os/mac/MacOSThread.javaoshi-common/src/main/java/oshi/software/common/os/mac/package-info.javaoshi-core-java25/src/main/java/oshi/software/os/mac/MacOSProcessFFM.javaoshi-core/src/main/java/oshi/hardware/platform/mac/MacHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/software/os/mac/MacOSProcess.javaoshi-core/src/main/java/oshi/software/os/mac/MacOperatingSystem.javaoshi-core/src/test/java/oshi/driver/mac/ThreadInfoTest.java
📜 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). (9)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, macos-latest
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 11, windows-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)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
🧰 Additional context used
🧠 Learnings (8)
📓 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-06T21:48:11.921Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3122
File: oshi-core/src/main/java/oshi/hardware/platform/mac/MacUsbDeviceJNA.java:85-111
Timestamp: 2026-04-06T21:48:11.921Z
Learning: In `oshi-core/src/main/java/oshi/hardware/platform/mac/MacUsbDeviceJNA.java` (and `MacUsbDeviceFFM.java`), the `id = 0L` sentinel is intentional when `device.getParentEntry(IOSERVICE)` returns null. It acts as a catch-all controller group for devices whose controller cannot be identified (an edge case that "should never happen" given the IORegistry format). Do not flag this as a bug or suggest skipping such devices; the design intentionally avoids both silently dropping orphaned devices and placing them at the top level without a controller context.
Applied to files:
oshi-core/src/test/java/oshi/driver/mac/ThreadInfoTest.javaoshi-core-java25/src/main/java/oshi/software/os/mac/MacOSProcessFFM.javaoshi-common/src/main/java/oshi/driver/common/mac/ThreadInfo.javaoshi-common/src/main/java/oshi/hardware/common/platform/mac/MacSoundCard.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/src/test/java/oshi/driver/mac/ThreadInfoTest.javaoshi-common/src/main/java/oshi/driver/common/mac/package-info.javaoshi-common/src/main/java/oshi/hardware/common/platform/mac/package-info.javaoshi-common/src/main/java/oshi/software/common/os/mac/package-info.javaoshi-core-java25/src/main/java/oshi/software/os/mac/MacOSProcessFFM.javaoshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/software/common/os/mac/MacOSThread.javaoshi-common/src/main/java/oshi/driver/common/mac/ThreadInfo.javaoshi-common/src/main/java/oshi/hardware/common/platform/mac/MacSoundCard.javaoshi-core/src/main/java/oshi/software/os/mac/MacOperatingSystem.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-core/src/test/java/oshi/driver/mac/ThreadInfoTest.javaoshi-common/src/main/java/oshi/driver/common/mac/package-info.javaoshi-common/src/main/java/oshi/hardware/common/platform/mac/package-info.javaoshi-common/src/main/java/oshi/software/common/os/mac/package-info.javaoshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/software/common/os/mac/MacOSThread.javaCHANGELOG.mdoshi-common/src/main/java/oshi/hardware/common/platform/mac/MacSoundCard.java
📚 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/software/os/mac/MacOSProcessFFM.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/mac/MacHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/software/os/mac/MacOSProcess.javaoshi-core/src/main/java/oshi/software/os/mac/MacOperatingSystem.java
📚 Learning: 2026-04-03T02:07:49.467Z
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:49.467Z
Learning: In `oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java` (and similar FFM/API implementations in OSHI), the `updateAttributes()` method intentionally uses `catch (Throwable e) { return false; }` without logging. This is by design: `updateAttributes()` is a public API method whose contract is to return `false` on failure; callers consume the boolean and would never see log output, so adding a log statement is not desired.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/mac/MacHardwareAbstractionLayer.java
📚 Learning: 2026-04-08T17:30:11.929Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3127
File: CHANGELOG.md:3-3
Timestamp: 2026-04-08T17:30:11.929Z
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 (13)
config/checkstyle-suppressions.xml (1)
41-41: Suppression range update looks correct.The
VisibilityModifiersuppression now matches the shifted field declaration lines inMacOperatingSystem.java.CHANGELOG.md (1)
20-20: Changelog entry is clear and consistent.This addition accurately documents the macOS class split into
oshi-common.oshi-common/src/main/java/oshi/driver/common/mac/ThreadInfo.java (1)
5-5: Package move preserves behavior.
ThreadInforelocation is clean, and the thread-state mapping logic remains intact.Also applies to: 80-98
oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacSoundCard.java (1)
20-20: Visibility update is appropriate for the package split.Making the class and constructor public enables the intended cross-package construction after relocation.
Also applies to: 31-31
oshi-core/src/test/java/oshi/driver/mac/ThreadInfoTest.java (1)
15-15: Test import update is correct.The test now references the relocated
ThreadInfotype fromoshi-common.oshi-core-java25/src/main/java/oshi/software/os/mac/MacOSProcessFFM.java (1)
86-86: Import migration is consistent with the refactor.
MacOSProcessFFMnow correctly depends on relocatedThreadInfoandMacOSThreadclasses.Also applies to: 91-91
oshi-core/src/main/java/oshi/software/os/mac/MacOperatingSystem.java (1)
28-28:getCurrentThread()fallback wiring is correct.The fallback now instantiates the relocated
MacOSThreadimplementation fromoshi-common.Also applies to: 133-137
oshi-core/src/main/java/oshi/software/os/mac/MacOSProcess.java (1)
42-47: Import migration is consistent and safe.Line 42 and Line 47 correctly point to the relocated
oshi-commonmacOS classes, and the existinggetThreadDetails()construction path remains compatible.oshi-common/src/main/java/module-info.java (1)
8-8: Module exports correctly match relocated packages.The new exports cleanly enable access to the moved macOS common classes without unrelated module-surface changes.
Also applies to: 13-13, 18-18
oshi-common/src/main/java/oshi/software/common/os/mac/MacOSThread.java (1)
2-2:MacOSThreadrelocation looks clean.The package move and header update are consistent with the new
oshi-commonstructure, with no logic regression.Also applies to: 5-5
oshi-common/src/main/java/oshi/hardware/common/platform/mac/package-info.java (1)
1-8: Good package metadata addition.Adding
package-info.javahere keeps the new macOS common hardware package documented and consistent with module exports.oshi-common/src/main/java/oshi/software/common/os/mac/package-info.java (1)
1-8: Package documentation is aligned with the refactor.This
package-info.javaaddition is consistent with the new macOS software-common package setup.oshi-core/src/main/java/oshi/hardware/platform/mac/MacHardwareAbstractionLayer.java (1)
14-14:MacSoundCardimport update is correct.Line 14 correctly targets the relocated class, and
getSoundCards()delegation remains fully compatible.
… macOS packages (#3144)
632e44d to
a416594
Compare
Sets up macOS packages in oshi-common by moving one clean leaf-node class into each of the three package categories (driver, hardware, software), mirroring the Windows package setup from #3143.
Moved classes
ThreadInfooshi.driver.macoshi.driver.common.macMacSoundCardoshi.hardware.platform.macoshi.hardware.common.platform.macMacOSThreadoshi.software.os.macoshi.software.common.os.macAll three are JNA-free leaf nodes with no same-package dependencies, making them clean candidates for the move.
Other changes
MacSoundCard: made class and constructorpublic(was package-private, now accessed cross-package)MacOSProcess,MacOperatingSystem,MacHardwareAbstractionLayer,MacOSProcessFFM, andThreadInfoTestpackage-info.javafiles for the new packagesoshi-commonmodule-info.javaSummary by CodeRabbit
Refactor
Chores