[Java] Add PlatformDetector for runtime classifier selection - #2173
Conversation
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
PlatformDetector for runtime classifier selection
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Not ready to approve
Malformed ELF metadata can bypass the fallback, and one test fails incorrectly on musl hosts.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds Java platform detection for selecting embedded native runtime classifiers.
Changes:
- Maps OS, architecture, and Linux libc to eight supported classifiers.
- Parses ELF
PT_INTERPand adds focused unit coverage.
File summaries
| File | Description |
|---|---|
PlatformDetector.java |
Implements platform, libc, and classifier detection. |
PlatformDetectorTest.java |
Tests mappings, ELF parsing, and unsupported platforms. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Medium
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅This PR adds Scope of change: Two new files, both under
No cross-SDK consistency issues found. This change is Java-specific infrastructure for embedding the Rust CLI runtime — a capability that does not exist in other language SDKs at the public API level. The other SDKs (Node.js, Python, Go, .NET, Rust) use different mechanisms to locate the CLI binary and do not need equivalent
|
There was a problem hiding this comment.
🟢 Ready to approve
The implementation matches the documented classifier policy and includes focused coverage for supported and malformed inputs.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Medium
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
3fd38b6
into
edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02
This PR implements task 4.2 of the Java embedded-runtime plan by adding a pure-Java platform detection utility that resolves
os,arch, and Linuxlibcinto the runtime classifier used to locateruntime.node. It also adds focused unit coverage for supported classifier resolution and fail-fast behavior on unsupported tuples.Platform detection utility (
com.github.copilot.ffi.PlatformDetector)detectOs()mappingos.nametodarwin | linux | win32.detectArch()mappingos.archaliases tox64 | arm64.detectLinuxLibc()with ELFPT_INTERPparsing from/proc/self/exe(first 2KB):"/ld-musl-"→MUSL"/ld-linux-"→GLIBCUNKNOWNdetectClassifier()and allow-list enforcement for the 8 ADR-007 classifiers.Classifier policy and fail-fast behavior
<os>-<arch>linuxmusl-<arch>linux-<arch>IllegalStateException.Unit coverage (
PlatformDetectorTest)glibcandmuslPT_INTERPpaths.