Repository navigation
Remove redundant WMI forwarding-shim classes (Sonar S9149) - #3608
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (10)
📝 WalkthroughWalkthroughThe change removes redundant Windows WMI FFM and JNA wrappers. Disk, storage-volume, sensor, test, and benchmark callers now use common WMI query classes. Linux power-source methods receive Sonar suppression annotations. ChangesWindows WMI migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to The change removes redundant forwarding classes and updates callers to use shared implementations, with validation reported successful and no actionable merge-blocking risk remaining beyond normal checks. 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 |
e186448 to
bc8c4b8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3608 +/- ##
============================================
- Coverage 79.88% 79.76% -0.12%
Complexity 76 76
============================================
Files 710 710
Lines 24242 24240 -2
Branches 4057 4057
============================================
- Hits 19366 19336 -30
- Misses 2715 2742 +27
- Partials 2161 2162 +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:
|
Delete 14 classes (7 JNA + 7 FFM) in oshi.driver.windows.wmi that existed only to redeclare the same static methods from their oshi-common base classes verbatim. Repoint all callers (3 JNA, 3 FFM, 1 test) directly at the shared base classes instead. The two LinuxPowerSource getPowerSources() findings are different: those have their own udev-based implementation that intentionally hides the base class's sysfs-only fallback. Suppressed with NOSONAR rather than renamed, since the method name is a cross-platform convention shared by all PowerSource implementations. Resolves 22 of the 27 open Sonar findings on master.
bc8c4b8 to
67efde4
Compare
Everything sat under "Bug Fixes and Improvements", which put the release's headline change in the wrong place and left one entry carrying three different kinds of change at once. New Features: the JSpecify adoption, rewritten to lead with what a consumer gets rather than what the sweep did to the build, and ParseUtil's new getStringValueOrEmpty, which was a clause in the middle of that paragraph. Behavior Changes: the null-to-sentinel list, promoted out of its sub-bullet. Someone whose code tests those getters for null now has dead branches, and that was the least visible thing in the section. #3616 moves here from Bug Fixes, being the same kind of change. Removals: #3608's 14 WMI forwarding shims, Util.isBlankOrUnknown and ParseUtil.slash, with a note that they sit outside the semver-guaranteed API and are listed only because removing them can break a compile. Bug Fixes and Improvements keeps #3589 and #3611/#3612, gains the hardening work split out of the JSpecify entry, and gains #3639, which had no entry at all: the Windows GPU utilization path tested its cached tick sample for null and then dereferenced it in a second read, so a concurrent poll could throw. Dependency bumps get no entries; none changed anything user-visible.
Summary
Resolves 22 of the 27 open Sonar findings on master (all
java:S9149).Deletes 14 classes (7 JNA + 7 FFM) in
oshi.driver.windows.wmithat existed only to redeclare the same static methods from theiroshi-commonbase classes verbatim —MSFTStorage{JNA,FFM},OhmHardware{JNA,FFM},OhmSensor{JNA,FFM},Win32DiskDrive{JNA,FFM},Win32DiskDriveToDiskPartition{JNA,FFM},Win32DiskPartition{JNA,FFM},Win32LogicalDiskToPartition{JNA,FFM}. All callers (3 JNA platform classes, 3 FFM platform classes, 1 test) now reference the shared base classes inoshi.driver.common.windows.wmidirectly.The two
LinuxPowerSource{FFM,JNA}.getPowerSources()findings are different: those have their own udev-based implementation that intentionally hides the base class's sysfs-only fallback. Suppressed withNOSONARrather than renamed, since the method name is a cross-platform convention shared by allPowerSourceimplementations.Test plan
./mvnw clean spotless:apply sortpom:sort checkstyle:check install -Perror-prone -DskipTests forbiddenapis:check javadoc:javadoc: BUILD SUCCESS, 0 warnings, 0 errorsgrep -rn 'MSFTStorageJNA\|MSFTStorageFFM\|OhmHardwareJNA\|OhmHardwareFFM\|OhmSensorJNA\|OhmSensorFFM\|Win32DiskDriveJNA\|Win32DiskDriveFFM\|Win32DiskDriveToDiskPartitionJNA\|Win32DiskDriveToDiskPartitionFFM\|Win32DiskPartitionJNA\|Win32DiskPartitionFFM\|Win32LogicalDiskToPartitionJNA\|Win32LogicalDiskToPartitionFFM' --include='*.java' .returns emptySummary by CodeRabbit
Refactor
Chores