Repository navigation
Convert static memoized suppliers to instance fields for memory reclaim - #3442
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (15)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2026-04-12T19:22:09.716ZApplied to files:
📚 Learning: 2026-07-06T19:25:59.225ZApplied to files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughMemoized suppliers were changed across NetBSD, Solaris, and Windows platform implementations. Solaris uptime and boot-time handling was separated, with Kstat2 and legacy kstat retrieval paths retained. The changelog records the update. ChangesSystem information lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SolarisOperatingSystemJNA
participant Kstat2
participant LegacyKstat
SolarisOperatingSystemJNA->>Kstat2: Query system_misc snaptime
Kstat2-->>SolarisOperatingSystemJNA: Return uptime seconds
SolarisOperatingSystemJNA->>LegacyKstat: Fall back to ks_snaptime
LegacyKstat-->>SolarisOperatingSystemJNA: Return uptime or 0
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/netbsd/NetBsdHWDiskStore.java`:
- Line 32: Update NetBsdHWDiskStore.getDisks() to execute iostat -x -I once and
share the resulting output while creating and initializing each disk store,
rather than allowing each instance’s iostat supplier to invoke the command
separately. Preserve the GC-friendly instance-scoped cache and adjust
initialization/updateAttributes() flow and related symbols as needed to consume
the shared result.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7b69ce8c-6eb4-4668-811c-92777880bdb1
📒 Files selected for processing (6)
CHANGELOG.mdoshi-common/src/main/java/oshi/hardware/common/platform/unix/netbsd/NetBsdHWDiskStore.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/Advapi32UtilFFM.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisFileSystemJNA.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisOperatingSystemJNA.javaoshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java
📜 Review details
⏰ Context from checks skipped due to timeout. (9)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/netbsd/NetBsdHWDiskStore.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/netbsd/NetBsdHWDiskStore.javaoshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/Advapi32UtilFFM.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisFileSystemJNA.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisOperatingSystemJNA.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/software/os/windows/WindowsOperatingSystemJNA.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisFileSystemJNA.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisOperatingSystemJNA.java
🔇 Additional comments (7)
oshi-core-ffm/src/main/java/oshi/ffm/util/platform/windows/Advapi32UtilFFM.java (2)
61-62: LGTM!
390-390: LGTM!oshi-core/src/main/java/oshi/software/os/windows/WindowsOperatingSystemJNA.java (2)
101-102: LGTM!
360-360: LGTM!CHANGELOG.md (1)
6-6: LGTM!oshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisFileSystemJNA.java (1)
27-50: LGTM!oshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisOperatingSystemJNA.java (1)
92-96: LGTM!Also applies to: 129-129, 137-169
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3442 +/- ##
============================================
- Coverage 74.39% 74.37% -0.03%
Complexity 76 76
============================================
Files 580 580
Lines 21946 21947 +1
Branches 3668 3668
============================================
- Hits 16326 16322 -4
- Misses 3581 3585 +4
- Partials 2039 2040 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Supplierfields to instance fields inNetBsdHWDiskStore,SolarisFileSystemJNA, andSolarisOperatingSystemJNA, allowing cached data to be garbage-collected when users create newSystemInfoinstances.systemLogsuppliers inWindowsOperatingSystemJNAandAdvapi32UtilFFMproperlystatic finalwith conventional naming (these hold OS-constant data so static is appropriate, but they were missingfinal).SolarisOperatingSystemJNAto eliminate a paired static memoizer that bundled both.Test plan
mvn compilepasses for all affected modulesmvn testpasses for oshi-common, oshi-core-ffmmvn testpasses for oshi-benchmark (JNA vs FFM comparison)Summary by CodeRabbit