Repository navigation
Improve API documentation - #3154
Conversation
Document every configuration property constant with descriptions mirroring oshi.properties comments, including defaults, platform notes, and cross-references. Enable checkstyle UnusedImports processJavadoc so imports used only in @see tags are not flagged as unused.
Add code examples showing both blocking and non-blocking CPU usage patterns. Document Windows Task Manager discrepancy and link to GlobalConfig.OSHI_OS_WINDOWS_CPU_UTILITY.
Document process CPU load polling pattern with snapshot map. Add memory guidance: getPrivateResidentMemory for Task Manager, getResidentMemory for ps/top. Note Windows CPU scaling.
Add usage example showing how to find the disk and partition for a file path via mount point correlation. Add @see links between the hardware and software storage classes.
Add platform-specific notes to each Sensors method regarding Windows jLibreHardwareMonitor dependency and Linux hwmon config. Add quick-start code examples to both JNA and FFM SystemInfo classes. Document platform coverage, memoization behavior, and cross-reference the alternative entry point.
Add performance guidance to NetworkIF.updateAttributes noting that re-querying the full list is more efficient for bulk updates. Add usage example to OperatingSystem.getProcesses showing top-10 by CPU with ProcessFiltering and ProcessSorting constants. Add usage example to GlobalMemory showing available/used memory calculation with FormatUtil.
|
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 (1)
📜 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)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2026-04-03T18:43:51.290ZApplied to files:
📚 Learning: 2026-04-05T05:40:45.797ZApplied to files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughEnabled Javadoc-aware unused-import checking and expanded API documentation across many modules; added and corrected numerous GlobalConfig keys (with deprecated aliases), updated CHANGELOG, adjusted Windows perfmon config usage, and a small test assertion exception. No public API signatures or runtime logic were changed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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🧪 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 #3154 +/- ##
============================================
+ Coverage 61.91% 62.12% +0.21%
Complexity 12 12
============================================
Files 39 39
Lines 2329 2329
Branches 407 407
============================================
+ Hits 1442 1447 +5
+ Misses 777 771 -6
- Partials 110 111 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/util/GlobalConfig.java (1)
154-173: Fix theDIABLEDtypo before these constants spread.The new identifiers
OSHI_OS_WINDOWS_PERFDISK_DIABLED,OSHI_OS_WINDOWS_PERFOS_DIABLED, andOSHI_OS_WINDOWS_PERFPROC_DIABLEDbake a spelling mistake into the constant names. Even though the property values are correct, leaving the typo here makes the API/docs harder to use and creates cleanup debt immediately.Suggested rename
- public static final String OSHI_OS_WINDOWS_PERFDISK_DIABLED = "oshi.os.windows.perfdisk.disabled"; + public static final String OSHI_OS_WINDOWS_PERFDISK_DISABLED = "oshi.os.windows.perfdisk.disabled"; ... - public static final String OSHI_OS_WINDOWS_PERFOS_DIABLED = "oshi.os.windows.perfos.disabled"; + public static final String OSHI_OS_WINDOWS_PERFOS_DISABLED = "oshi.os.windows.perfos.disabled"; ... - public static final String OSHI_OS_WINDOWS_PERFPROC_DIABLED = "oshi.os.windows.perfproc.disabled"; + public static final String OSHI_OS_WINDOWS_PERFPROC_DISABLED = "oshi.os.windows.perfproc.disabled";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@oshi-common/src/main/java/oshi/util/GlobalConfig.java` around lines 154 - 173, The three public constant names in GlobalConfig—OSHI_OS_WINDOWS_PERFDISK_DIABLED, OSHI_OS_WINDOWS_PERFOS_DIABLED, and OSHI_OS_WINDOWS_PERFPROC_DIABLED—contain a spelling mistake ("DIABLED"); rename them to OSHI_OS_WINDOWS_PERFDISK_DISABLED, OSHI_OS_WINDOWS_PERFOS_DISABLED, and OSHI_OS_WINDOWS_PERFPROC_DISABLED respectively, update any Javadoc references and all usages across the codebase to the new identifiers, and keep the property string values unchanged (they are already correct) to preserve runtime behavior and compatibility.
🤖 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/module-info.java`:
- Around line 11-13: Doc comment incorrectly instructs implementers to override
query*() methods for hardware subclasses; update the text to state that
subclasses of the abstract base classes in oshi.hardware.common (notably
AbstractHardwareAbstractionLayer) should extend via create*() factory methods,
while platform-specific logic remains in the protected abstract query*() methods
on software-side or specific components; change the sentence referencing
"override the {`@code` protected abstract query*()} methods" to explicitly mention
"override the {`@code` create*()} factory methods in
AbstractHardwareAbstractionLayer and override the {`@code` protected abstract
query*()} methods where applicable (e.g., software or component-level
implementations)" so implementers can find the correct hooks.
In `@oshi-common/src/main/java/oshi/hardware/CentralProcessor.java`:
- Around line 153-164: The example initializes prevTicks to zeros which causes
the first getSystemCpuLoadBetweenTicks(prevTicks) sample to be incorrect; change
the sample code in the Javadoc to seed prevTicks with a real snapshot by calling
cpu.getSystemCpuLoadTicks() once before entering the loop (use the
CentralProcessor instance referenced as cpu), then call
getSystemCpuLoadBetweenTicks(prevTicks) inside the loop and update prevTicks
from getSystemCpuLoadTicks() each iteration so the first reported sample
reflects the interval rather than cumulative boot ticks.
In `@oshi-common/src/main/java/oshi/util/GlobalConfig.java`:
- Around line 214-225: The Javadoc security example currently splits the path
across lines to avoid the comment terminator, which prevents the literal
`/proc/*/environ` from rendering; update the Javadoc in GlobalConfig (near the
OSHI_OS_LINUX_PRIVILEGED_PREFIX constant) to use a Javadoc inline tag such as
{`@code` /proc/*/environ} or {`@literal` /proc/*/environ} so the full literal path
appears correctly in generated docs and remove the line split that produces the
broken display.
In `@oshi-core/src/main/java/oshi/SystemInfo.java`:
- Around line 53-56: Update the class Javadoc for SystemInfo to explicitly
include Android in the supported-platform list (add "Android" alongside Windows,
macOS, Linux, FreeBSD, OpenBSD, Solaris, AIX) and, if helpful for clarity,
mention that PlatformEnum.ANDROID is currently routed through the Linux JNA
implementations used by createOperatingSystem() and createHardware(); reference
SystemInfo, createOperatingSystem(), createHardware(), and PlatformEnum.ANDROID
so readers understand the existing Android routing behavior.
---
Nitpick comments:
In `@oshi-common/src/main/java/oshi/util/GlobalConfig.java`:
- Around line 154-173: The three public constant names in
GlobalConfig—OSHI_OS_WINDOWS_PERFDISK_DIABLED, OSHI_OS_WINDOWS_PERFOS_DIABLED,
and OSHI_OS_WINDOWS_PERFPROC_DIABLED—contain a spelling mistake ("DIABLED");
rename them to OSHI_OS_WINDOWS_PERFDISK_DISABLED,
OSHI_OS_WINDOWS_PERFOS_DISABLED, and OSHI_OS_WINDOWS_PERFPROC_DISABLED
respectively, update any Javadoc references and all usages across the codebase
to the new identifiers, and keep the property string values unchanged (they are
already correct) to preserve runtime behavior and compatibility.
🪄 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: 196e2a1d-d029-4205-81e8-e8fc78b9a90c
📒 Files selected for processing (16)
config/checkstyle.xmloshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/hardware/CentralProcessor.javaoshi-common/src/main/java/oshi/hardware/GlobalMemory.javaoshi-common/src/main/java/oshi/hardware/HWDiskStore.javaoshi-common/src/main/java/oshi/hardware/HardwareAbstractionLayer.javaoshi-common/src/main/java/oshi/hardware/NetworkIF.javaoshi-common/src/main/java/oshi/hardware/Sensors.javaoshi-common/src/main/java/oshi/hardware/VirtualMemory.javaoshi-common/src/main/java/oshi/software/os/OSFileStore.javaoshi-common/src/main/java/oshi/software/os/OSProcess.javaoshi-common/src/main/java/oshi/software/os/OperatingSystem.javaoshi-common/src/main/java/oshi/util/GlobalConfig.javaoshi-core-java25/src/main/java/oshi/ffm/SystemInfo.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/main/java/oshi/package-info.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
- GitHub Check: Test JDK 25, macos-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 11, macos-latest
- GitHub Check: Test JDK 11, windows-latest
- GitHub Check: windows-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: macos-latest
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (7)
📓 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.
📚 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/NetworkIF.javaoshi-common/src/main/java/oshi/hardware/HardwareAbstractionLayer.javaoshi-common/src/main/java/oshi/hardware/HWDiskStore.javaoshi-common/src/main/java/oshi/software/os/OSProcess.javaoshi-common/src/main/java/oshi/hardware/VirtualMemory.javaoshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/software/os/OperatingSystem.javaoshi-common/src/main/java/oshi/hardware/GlobalMemory.javaoshi-common/src/main/java/oshi/hardware/CentralProcessor.javaoshi-common/src/main/java/oshi/software/os/OSFileStore.javaoshi-common/src/main/java/oshi/util/GlobalConfig.javaoshi-common/src/main/java/oshi/hardware/Sensors.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/HardwareAbstractionLayer.javaoshi-common/src/main/java/oshi/software/os/OSProcess.javaoshi-common/src/main/java/oshi/hardware/VirtualMemory.javaoshi-core/src/main/java/oshi/package-info.javaoshi-common/src/main/java/module-info.javaoshi-core-java25/src/main/java/oshi/ffm/SystemInfo.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-common/src/main/java/oshi/hardware/CentralProcessor.javaoshi-common/src/main/java/oshi/software/os/OSFileStore.javaoshi-common/src/main/java/oshi/util/GlobalConfig.java
📚 Learning: 2026-04-05T15:37:17.867Z
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:17.867Z
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/HardwareAbstractionLayer.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/HardwareAbstractionLayer.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/main/java/oshi/package-info.javaoshi-common/src/main/java/module-info.javaoshi-core-java25/src/main/java/oshi/ffm/SystemInfo.javaoshi-core/src/main/java/oshi/SystemInfo.java
📚 Learning: 2026-04-12T19:34:56.879Z
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:34:56.879Z
Learning: The counterintuitive naming of `PhysicalProcessor.getEfficiency()` / `EfficiencyClass` in OSHI (where a higher value means MORE performance and LESS efficiency, so P-cores get higher values than E-cores) is intentionally inherited from Microsoft's `PROCESSOR_RELATIONSHIP.EfficiencyClass` Win32 API: "A core with a higher value for the efficiency class has intrinsically greater performance and less efficiency." OSHI follows this same convention for cross-platform consistency. Do not flag P-cores being assigned higher efficiency values as a bug.
Applied to files:
oshi-common/src/main/java/oshi/hardware/CentralProcessor.java
🔇 Additional comments (7)
config/checkstyle.xml (1)
48-48: Good checkstyle alignment for Javadoc-heavy changes.Line [48] correctly enables
processJavadoc, which keeps Javadoc@link/@seeimports from being treated as unused during this doc-focused PR.oshi-common/src/main/java/oshi/hardware/NetworkIF.java (1)
299-303: Nice performance guidance for polling patterns.Lines [299]-[303] clearly distinguish single-interface refresh from multi-interface polling and set the right expectation about full-list queries on many platforms.
oshi-common/src/main/java/oshi/hardware/HardwareAbstractionLayer.java (1)
48-50: Good cross-linking between hardware partitions and file stores.Lines [48]-[50] improve discoverability of the disk-partition-to-filesystem mapping workflow.
oshi-common/src/main/java/oshi/hardware/HWDiskStore.java (1)
10-40: Solid documentation expansion with actionable example.Lines [18]-[40] give a clear partition-to-mount correlation path, and Line [10] correctly supports the new
OSFileStorereferences.oshi-common/src/main/java/oshi/software/os/OperatingSystem.java (1)
163-168: Good API docs update for process filtering/sorting usage.Lines [163]-[168] provide a practical snippet, and Line [171] now points to the correct
ProcessFilteringconstants.Also applies to: 171-171, 175-175
oshi-common/src/main/java/oshi/hardware/VirtualMemory.java (1)
10-29: Great cross-platform clarification of virtual-memory semantics.Lines [10]-[29] set correct expectations for interpreting
getVirtualMax()andgetVirtualInUse()across OSes.oshi-common/src/main/java/oshi/software/os/OSFileStore.java (1)
8-9: Nice bidirectional doc linkage for storage mapping.Lines [15]-[21] clearly connect
OSFileStore#getMount()withHWPartition#getMountPoint(), and Lines [8]-[9] correctly support those references.Also applies to: 15-21
| * This is the recommended approach for non-blocking periodic monitoring. Store the tick array from one call and | ||
| * pass it on the next iteration: | ||
| * | ||
| * <pre>{@code | ||
| * long[] prevTicks = new long[TickType.values().length]; | ||
| * while (monitoring) { | ||
| * double load = cpu.getSystemCpuLoadBetweenTicks(prevTicks); | ||
| * prevTicks = cpu.getSystemCpuLoadTicks(); | ||
| * System.out.printf("CPU: %.1f%%%n", load * 100); | ||
| * Thread.sleep(1000); | ||
| * } | ||
| * }</pre> |
There was a problem hiding this comment.
Seed prevTicks with a real snapshot before the loop.
Lines 157-160 initialize prevTicks to zeros, so the first call returns a cumulative value from boot/current ticks rather than usage over the sampling interval this example is describing. That makes the copy-paste example produce a bogus first sample.
Suggested doc fix
- * long[] prevTicks = new long[TickType.values().length];
- * while (monitoring) {
- * double load = cpu.getSystemCpuLoadBetweenTicks(prevTicks);
- * prevTicks = cpu.getSystemCpuLoadTicks();
+ * long[] prevTicks = cpu.getSystemCpuLoadTicks();
+ * while (monitoring) {
+ * Thread.sleep(1000);
+ * long[] ticks = cpu.getSystemCpuLoadTicks();
+ * double load = cpu.getSystemCpuLoadBetweenTicks(prevTicks, ticks);
+ * prevTicks = ticks;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@oshi-common/src/main/java/oshi/hardware/CentralProcessor.java` around lines
153 - 164, The example initializes prevTicks to zeros which causes the first
getSystemCpuLoadBetweenTicks(prevTicks) sample to be incorrect; change the
sample code in the Javadoc to seed prevTicks with a real snapshot by calling
cpu.getSystemCpuLoadTicks() once before entering the loop (use the
CentralProcessor instance referenced as cpu), then call
getSystemCpuLoadBetweenTicks(prevTicks) inside the loop and update prevTicks
from getSystemCpuLoadTicks() each iteration so the first reported sample
reflects the interval rather than cumulative boot ticks.
| * A comma-separated list of file paths eligible for privileged read via {@code sudo cat} fallback on Linux when | ||
| * normal file read fails due to permissions. Supports Java glob patterns ({@code *}, {@code ?}, {@code [abc]}). | ||
| * <p> | ||
| * <b>Security warning:</b> Take care when adding paths. Allowing privileged reads of sensitive files such as | ||
| * {@code /proc/* | ||
| / | ||
| environ} can expose credentials to unprivileged users. Default is the empty | ||
| * | ||
| * string (no files allowed). | ||
| * | ||
| * @see #OSHI_OS_LINUX_PRIVILEGED_PREFIX | ||
| */ |
There was a problem hiding this comment.
Render /proc/*/environ as the literal path in the warning.
Splitting the example path across lines avoids the */ terminator in source, but it also means the generated Javadoc will not show the actual /proc/*/environ path cleanly. For a security warning, that makes the example less clear than it should be.
Suggested Javadoc-safe formatting
- * <b>Security warning:</b> Take care when adding paths. Allowing privileged reads of sensitive files such as
- * {`@code` /proc/*
- /
- environ} can expose credentials to unprivileged users. Default is the empty
- *
- * string (no files allowed).
+ * <b>Security warning:</b> Take care when adding paths. Allowing privileged reads of sensitive files such as
+ * {`@code` /proc/}{`@literal` *}{`@code` /environ} can expose credentials to unprivileged users. Default is the empty
+ * string (no files allowed).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * A comma-separated list of file paths eligible for privileged read via {@code sudo cat} fallback on Linux when | |
| * normal file read fails due to permissions. Supports Java glob patterns ({@code *}, {@code ?}, {@code [abc]}). | |
| * <p> | |
| * <b>Security warning:</b> Take care when adding paths. Allowing privileged reads of sensitive files such as | |
| * {@code /proc/* | |
| / | |
| environ} can expose credentials to unprivileged users. Default is the empty | |
| * | |
| * string (no files allowed). | |
| * | |
| * @see #OSHI_OS_LINUX_PRIVILEGED_PREFIX | |
| */ | |
| * A comma-separated list of file paths eligible for privileged read via {`@code` sudo cat} fallback on Linux when | |
| * normal file read fails due to permissions. Supports Java glob patterns ({`@code` *}, {`@code` ?}, {`@code` [abc]}). | |
| * <p> | |
| * <b>Security warning:</b> Take care when adding paths. Allowing privileged reads of sensitive files such as | |
| * {`@code` /proc/}{`@literal` *}{`@code` /environ} can expose credentials to unprivileged users. Default is the empty | |
| * string (no files allowed). | |
| * | |
| * `@see` `#OSHI_OS_LINUX_PRIVILEGED_PREFIX` | |
| */ |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@oshi-common/src/main/java/oshi/util/GlobalConfig.java` around lines 214 -
225, The Javadoc security example currently splits the path across lines to
avoid the comment terminator, which prevents the literal `/proc/*/environ` from
rendering; update the Javadoc in GlobalConfig (near the
OSHI_OS_LINUX_PRIVILEGED_PREFIX constant) to use a Javadoc inline tag such as
{`@code` /proc/*/environ} or {`@literal` /proc/*/environ} so the full literal path
appears correctly in generated docs and remove the line split that produces the
broken display.
Multiple updates to Javadocs combining information from existing README, FAQ, oshi-demo, oshi-properties comments, and other sources addressing common use cases.
Resolves #2746
Summary by CodeRabbit
Documentation
Configuration
Bug Fixes
Tests