Repository navigation
Remove deprecated methods and classes - #3182
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 (19)
💤 Files with no reviewable changes (9)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📜 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)
📝 WalkthroughWalkthroughThis PR removes several deprecated public APIs and constants for v7.0.0: Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
oshi-core/src/test/java/oshi/SystemInfoTest.java (1)
60-69:⚠️ Potential issue | 🟡 MinorMangled class Javadoc and misplaced import.
The class-level Javadoc got truncated during editing — lines 65-66 currently read:
/** of access to many of OSHI's capabilities */That's a dangling fragment (the opening sentence, e.g. "A demonstration of access to many of OSHI's capabilities.", is gone), and it will surface in generated Javadoc / IDE tooltips as-is. Additionally, the newly added
import oshi.util.PlatformEnum;on line 63 is separated from the precedingoshi.util.Utilimport by a blank line, orphaning it from theoshi.util.*group.🩹 Proposed fix
import oshi.util.FormatUtil; +import oshi.util.PlatformEnum; import oshi.util.Util; -import oshi.util.PlatformEnum; - -/** of access to many of OSHI's capabilities +/** + * A demonstration of access to many of OSHI's capabilities. */ `@Execution`(ExecutionMode.SAME_THREAD)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@oshi-core/src/test/java/oshi/SystemInfoTest.java` around lines 60 - 69, Restore the class Javadoc in SystemInfoTest to a complete sentence (e.g., "A demonstration of access to many of OSHI's capabilities.") replacing the dangling fragment between /** and */ and ensure the import grouping is tidy by moving the import oshi.util.PlatformEnum so it sits with the other oshi.util imports (alongside oshi.util.FormatUtil and oshi.util.Util) without the extra blank line.
🧹 Nitpick comments (2)
oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java (1)
45-47: Minor: import grouping.
import oshi.util.PlatformEnum;(line 45) is placed beforeoshi.hardware.*/oshi.software.os.*, breaking the alphabeticaloshi.*grouping used elsewhere in the file. Consider moving it after line 47 to keep the section sorted. Same checkstyle consideration as noted onoshi-core/src/main/java/oshi/SystemInfo.java.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java` around lines 45 - 47, The import order breaks the alphabetical grouping for oshi.* imports: move the import of PlatformEnum so that the three oshi imports are alphabetically ordered (HardwareAbstractionLayer, OperatingSystem, PlatformEnum) e.g., place the PlatformEnum import after the OperatingSystem import to satisfy the project's import grouping/checkstyle rules and keep imports consistent with other files.oshi-core/src/main/java/oshi/SystemInfo.java (1)
11-19: Import ordering:oshi.util.PlatformEnumis out of place.Line 13 places
oshi.util.PlatformEnumbetweenoshi.hardware.platform.linux.*andoshi.hardware.platform.mac.*imports, which breaks the logical grouping. The FFM variant (oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java) correctly placesoshi.util.*imports after theoshi.software.os.*block. Consider movingPlatformEnumto the same position here for consistency.Suggested reordering
import oshi.hardware.HardwareAbstractionLayer; import oshi.hardware.platform.linux.LinuxHardwareAbstractionLayerJNA; -import oshi.util.PlatformEnum; import oshi.hardware.platform.mac.MacHardwareAbstractionLayerJNA;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@oshi-core/src/main/java/oshi/SystemInfo.java` around lines 11 - 19, The import order in SystemInfo.java is inconsistent: move the oshi.util.PlatformEnum import so it is grouped with other oshi.util.*/oshi.software.os.* imports (i.e., place PlatformEnum after the oshi.hardware.platform.* imports block) to match the FFM variant; update the import list in the SystemInfo class (referencing the PlatformEnum symbol) so imports are logically grouped and consistent with oshi-core-ffm's ordering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@oshi-core/src/test/java/oshi/SystemInfoTest.java`:
- Around line 60-69: Restore the class Javadoc in SystemInfoTest to a complete
sentence (e.g., "A demonstration of access to many of OSHI's capabilities.")
replacing the dangling fragment between /** and */ and ensure the import
grouping is tidy by moving the import oshi.util.PlatformEnum so it sits with the
other oshi.util imports (alongside oshi.util.FormatUtil and oshi.util.Util)
without the extra blank line.
---
Nitpick comments:
In `@oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java`:
- Around line 45-47: The import order breaks the alphabetical grouping for
oshi.* imports: move the import of PlatformEnum so that the three oshi imports
are alphabetically ordered (HardwareAbstractionLayer, OperatingSystem,
PlatformEnum) e.g., place the PlatformEnum import after the OperatingSystem
import to satisfy the project's import grouping/checkstyle rules and keep
imports consistent with other files.
In `@oshi-core/src/main/java/oshi/SystemInfo.java`:
- Around line 11-19: The import order in SystemInfo.java is inconsistent: move
the oshi.util.PlatformEnum import so it is grouped with other
oshi.util.*/oshi.software.os.* imports (i.e., place PlatformEnum after the
oshi.hardware.platform.* imports block) to match the FFM variant; update the
import list in the SystemInfo class (referencing the PlatformEnum symbol) so
imports are logically grouped and consistent with oshi-core-ffm's ordering.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2c6ffad1-7dda-4325-9980-e156e6716be5
📒 Files selected for processing (19)
CHANGELOG.mdoshi-common/src/main/java/oshi/software/common/os/windows/WindowsOSProcess.javaoshi-common/src/main/java/oshi/software/os/OSProcess.javaoshi-common/src/main/java/oshi/util/GlobalConfig.javaoshi-common/src/test/java/oshi/software/os/OSProcessTest.javaoshi-core-ffm/src/main/java/module-info.javaoshi-core-ffm/src/main/java/oshi/PlatformEnumFFM.javaoshi-core-ffm/src/main/java/oshi/SystemInfoFFM.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core-java11/.gitignoreoshi-core/src/main/java/oshi/PlatformEnum.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/test/java/oshi/SystemInfoTest.javaoshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.javaoshi-core/src/test/java/oshi/util/platform/unix/openbsd/FstatUtilTest.javaoshi-demo/src/main/java/oshi/demo/gui/FileStorePanel.javaoshi-demo/src/main/java/oshi/demo/gui/ProcessPanel.javaoshi-demo/src/main/java/oshi/demo/jmx/JMXOshiAgentServer.javasrc/site/markdown/Upgrading.md
💤 Files with no reviewable changes (9)
- oshi-core-ffm/src/main/java/module-info.java
- oshi-common/src/main/java/oshi/software/common/os/windows/WindowsOSProcess.java
- oshi-common/src/main/java/oshi/software/os/OSProcess.java
- oshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.java
- oshi-common/src/test/java/oshi/software/os/OSProcessTest.java
- oshi-core-ffm/src/main/java/oshi/SystemInfoFFM.java
- oshi-core-ffm/src/main/java/oshi/PlatformEnumFFM.java
- oshi-common/src/main/java/oshi/util/GlobalConfig.java
- oshi-core/src/main/java/oshi/PlatformEnum.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). (10)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 11, windows-latest
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 11, macos-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (8)
📚 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/.gitignoreoshi-demo/src/main/java/oshi/demo/jmx/JMXOshiAgentServer.javaoshi-demo/src/main/java/oshi/demo/gui/ProcessPanel.javaoshi-demo/src/main/java/oshi/demo/gui/FileStorePanel.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaCHANGELOG.mdsrc/site/markdown/Upgrading.mdoshi-core/src/test/java/oshi/SystemInfoTest.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-java11/.gitignoreoshi-demo/src/main/java/oshi/demo/jmx/JMXOshiAgentServer.javaoshi-core/src/test/java/oshi/util/platform/unix/openbsd/FstatUtilTest.javaoshi-demo/src/main/java/oshi/demo/gui/ProcessPanel.javaoshi-demo/src/main/java/oshi/demo/gui/FileStorePanel.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaCHANGELOG.mdsrc/site/markdown/Upgrading.mdoshi-core/src/test/java/oshi/SystemInfoTest.java
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
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-demo/src/main/java/oshi/demo/jmx/JMXOshiAgentServer.javaoshi-core/src/test/java/oshi/util/platform/unix/openbsd/FstatUtilTest.javaoshi-demo/src/main/java/oshi/demo/gui/ProcessPanel.javaoshi-demo/src/main/java/oshi/demo/gui/FileStorePanel.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core/src/test/java/oshi/SystemInfoTest.java
📚 Learning: 2026-04-03T18:43:51.290Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:99-100
Timestamp: 2026-04-03T18:43:51.290Z
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-core/src/test/java/oshi/util/platform/unix/openbsd/FstatUtilTest.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java
📚 Learning: 2026-04-18T03:18:03.725Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3170
File: oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java:177-183
Timestamp: 2026-04-18T03:18:03.725Z
Learning: In `oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java`, GPU engine PDH instance counts (from `GpuInformationJNA.queryGpuEngineCounters()` / `GpuInformationFFM.queryGpuEngineCounters()`) are highly volatile — counts can differ dramatically (e.g., 53 vs 40) even between queries taken milliseconds apart. Do not assert instance count equality or exact instance list matching between JNA and FFM results. The only reliable assertion is that both are empty or both are non-empty (`assertThat(ffm.getA().isEmpty()).isEqualTo(jna.getA().isEmpty())`).
Applied to files:
oshi-core/src/test/java/oshi/util/platform/unix/openbsd/FstatUtilTest.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.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-core/src/main/java/oshi/SystemInfo.java
📚 Learning: 2026-04-05T05:40:45.797Z
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:45.797Z
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.
Applied to files:
oshi-core/src/main/java/oshi/SystemInfo.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.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-ffm/src/test/java/oshi/ffm/SystemInfoTest.java
🔇 Additional comments (8)
oshi-core-java11/.gitignore (1)
1-1: Good cleanup — ignoring/bin/is a sensible repo hygiene change.This helps prevent accidental commits of local/generated artifacts, and I don’t see any downside in this context.
oshi-demo/src/main/java/oshi/demo/jmx/JMXOshiAgentServer.java (1)
40-40: LGTM!Import swap to
oshi.util.PlatformEnumis correct;PlatformEnum.getCurrentPlatform()on line 105 resolves to the new API.oshi-demo/src/main/java/oshi/demo/gui/FileStorePanel.java (1)
30-30: LGTM!Mechanical migration to
oshi.util.PlatformEnum;PlatformEnum.WINDOWScomparison on line 101 remains valid.oshi-demo/src/main/java/oshi/demo/gui/ProcessPanel.java (1)
28-28: LGTM!Import update aligns with the deprecated
oshi.PlatformEnumremoval; enum usages at lines 76 and 132 resolve correctly againstoshi.util.PlatformEnum.oshi-core/src/test/java/oshi/util/platform/unix/openbsd/FstatUtilTest.java (1)
12-17: Clean migration tooshi.util.PlatformEnum.Both the static
OPENBSDimport (line 12) and the type import (line 17) correctly resolve to the newoshi.util.PlatformEnuminoshi-common, matching the PR-wide rename.oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java (1)
55-66: Assertions correctly retargeted toPlatformEnum.UNKNOWN.
testPlatformEnumandtestGetCurrentPlatformnow use the unifiedoshi.util.PlatformEnum, and dropping@SuppressWarnings("deprecation")is appropriate since the oldPlatformEnumFFM/SystemInfoFFM.getCurrentPlatform()paths are gone. Semantics ofUNKNOWN(fallback whenos.nameis unrecognized) match the oldUNSUPPORTEDusage here.CHANGELOG.md (1)
9-9: Breaking-changes entry accurately captures all four removals.The bullet correctly enumerates
getResidentSetSize(),oshi.PlatformEnum/PlatformEnumFFM,SystemInfo.getCurrentPlatform()/SystemInfoFFM, and the misspelledGlobalConfigconstants, with the right replacements. Consistent with the deprecations originally announced in#3082and#3112.src/site/markdown/Upgrading.md (1)
3-36: Migration guide reads well and matches the code changes.Each removed API is paired with its replacement, including the subtle Windows-specific note that old
getResidentSetSize()returned the private working set (sogetPrivateResidentMemory()is the drop-in there, notgetResidentMemory()). TheGlobalConfigDIABLED → DISABLED table is a nice touch.One tiny nit (non-blocking): the section header on line 5 "replaced by two methods" and the
PlatformEnumsection could benefit from an explicit@since 7.0.0style note or a link to the CHANGELOG entry for readers arriving here from release notes — but given the doc lives under a clearly versioned 6.x→7.x heading, this is purely optional.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3182 +/- ##
==========================================
+ Coverage 57.36% 57.37% +0.01%
==========================================
Files 424 421 -3
Lines 20346 20272 -74
Branches 3577 3563 -14
==========================================
- Hits 11671 11632 -39
+ Misses 6907 6878 -29
+ Partials 1768 1762 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Remove OSProcess.getResidentSetSize() (replaced by getResidentMemory() and getPrivateResidentMemory()), oshi.PlatformEnum and PlatformEnumFFM (replaced by oshi.util.PlatformEnum), SystemInfo.getCurrentPlatform() and SystemInfoFFM (replaced by PlatformEnum.getCurrentPlatform() and oshi.ffm.SystemInfo), and misspelled GlobalConfig constants. Update Upgrading.md with migration guide.
62281b8 to
baf548e
Compare
Remove deprecated API elements:
OSProcess.getResidentSetSize()— replaced bygetResidentMemory()andgetPrivateResidentMemory()oshi.PlatformEnum(oshi-core) andoshi.PlatformEnumFFM(oshi-core-ffm) — replaced byoshi.util.PlatformEnumSystemInfo.getCurrentPlatform()andSystemInfoFFM— replaced byPlatformEnum.getCurrentPlatform()andoshi.ffm.SystemInfoGlobalConfigconstants (DIABLED→DISABLED)Updates Upgrading.md with migration guide and CHANGELOG.md with summary.
Summary by CodeRabbit
Breaking Changes
Documentation