Repository navigation
Extract Mac/Windows NetworkParams common bases - #3457
Conversation
Mac and Windows were the two platforms whose NetworkParams still lacked a common base (unlike Linux/AIX/BSD/Solaris), so their JNA and FFM twins each duplicated the command-line default-gateway lookups. Add the missing bases and hoist that shared logic. MacNetworkParams holds getIpv4/getIpv6DefaultGateway (route / netstat parsing); the Mac twins keep only their native getDomainName/getHostName (getaddrinfo / gethostname). WindowsNetworkParams holds getIpv4/getIpv6DefaultGateway (route print parsing); the Windows twins keep native getDomainName/getDnsServers/ getHostName. The twins' super.getHostName() fallbacks still resolve to AbstractNetworkParams, which the new bases do not override. No user-facing change; NetworkParams JNA==FFM comparison passes.
|
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 (6)
📜 Recent review details⏰ Context from checks skipped due to timeout. (15)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2026-04-12T19:22:09.716ZApplied to files:
📚 Learning: 2026-07-06T19:25:59.225ZApplied to files:
📚 Learning: 2026-04-06T04:45:47.644ZApplied to files:
🔇 Additional comments (6)
📝 WalkthroughWalkthroughmacOS and Windows default-gateway lookup logic moved into shared abstract network-parameter classes. JNA and FFM implementations now inherit platform-specific gateway parsing while retaining their native hostname, domain, and DNS behavior. ChangesNetwork gateway refactor
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3457 +/- ##
============================================
- Coverage 74.69% 74.63% -0.06%
Complexity 76 76
============================================
Files 584 586 +2
Lines 21862 21838 -24
Branches 3671 3663 -8
============================================
- Hits 16329 16298 -31
- Misses 3491 3500 +9
+ Partials 2042 2040 -2
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
Continues Item 6 of the cross-OS dedup audit (NetworkParams half). Mac and Windows were the only platforms whose
NetworkParamsstill lacked a common base — Linux/AIX/FreeBSD/NetBSD/OpenBSD/Solaris all have one — so their JNA and FFM twins each carried a full copy of the command-line default-gateway lookups. This adds the two missing bases, mirroring the Windows-memory dedup (#3453).Changes
MacNetworkParams(software.common.os.mac): holdsgetIpv4DefaultGateway/getIpv6DefaultGateway(theroute -n get defaultandnetstat -nrparsing) + the route constants. Mac JNA/FFM twins extend it and keep only their nativegetDomainName/getHostName(getaddrinfo/gethostname).WindowsNetworkParams(software.common.os.windows): holdsgetIpv4DefaultGateway/getIpv6DefaultGateway(theroute printparsing). Windows JNA/FFM twins extend it and keep nativegetDomainName/getDnsServers/getHostName(GetComputerNameEx/GetNetworkParams).super.getHostName()fallbacks still resolve toAbstractNetworkParams— the new bases don't override it.Both target packages were already declared and exported in
module-info, so no module changes were needed.~96 lines of identical command-line gateway/route code collapsed from two copies each into one base (net raw count roughly flat since the two base files are new).
Behavior
No user-facing change — same gateway/route parsing, only relocated; the native hostname/DNS calls stay per-backend.
Testing
install: BUILD SUCCESS, 0 tests failedNativeComparisonTest.networkParams()JNA==FFM comparison: passes on macOSSummary by CodeRabbit