Skip to content

Add CLI classpath options - #184

Merged
dlunch merged 5 commits into
mainfrom
agent/cli-classpath
Jul 19, 2026
Merged

Add CLI classpath options#184
dlunch merged 5 commits into
mainfrom
agent/cli-classpath

Conversation

@dlunch

@dlunch dlunch commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • add -cp and -classpath launcher options with CLASSPATH and current-directory fallback
  • match Oracle launcher argument boundaries and ignore user classpath in CLI -jar mode
  • preserve the public run API classpath behavior and built-in runtime priority
  • make URLClassLoader recognize directory entries without trailing slashes and continue past missing entries

Validation

  • cargo test --workspace --quiet (246 passed, 1 ignored)
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • git diff --check

Notes

The local environment does not contain an Oracle rt.jar, so the external JRE smoke test was not run. The same directory and JAR lookup paths are covered with repository fixtures and actual CLI process tests.

Copilot AI review requested due to automatic review settings July 19, 2026 01:32
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.21875% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.89%. Comparing base (fd629c7) to head (230b36c).

Files with missing lines Patch % Lines
java_runtime/src/classes/java/lang/class_loader.rs 95.83% 1 Missing ⚠️
...classes/org/rustjava/lang/rust_jar_class_loader.rs 97.91% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #184      +/-   ##
==========================================
+ Coverage   86.50%   86.89%   +0.38%     
==========================================
  Files         207      208       +1     
  Lines       20224    20420     +196     
==========================================
+ Hits        17495    17744     +249     
+ Misses       2729     2676      -53     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Java-launcher-compatible classpath handling to the rust_java CLI, aligning option parsing with the Oracle launcher while preserving the existing run API behavior. It also improves URLClassLoader resource lookup semantics around directory entries and missing URLs.

Changes:

  • Add -cp / -classpath support with CLASSPATH and current-directory fallback, and ignore user classpath in CLI -jar mode.
  • Refactor classpath property construction into a dedicated helper and add unit/integration coverage for launcher parsing/behavior.
  • Update URLClassLoader to treat directory URLs without trailing slashes as directories and to continue searching after missing entries.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_cli.rs Adds end-to-end CLI tests for classpath options, env fallback, -jar behavior, and error reporting.
src/main.rs Implements launcher-style argument parsing (-cp/-classpath/-jar) and wires computed classpath into run.
src/lib.rs Extracts classpath property construction into build_class_path and adds unit tests for ordering/empty entries.
java_runtime/tests/classes/java/net/test_url_class_loader.rs Adds regression test ensuring missing URL entries don’t prevent later JAR resource lookup.
java_runtime/src/classes/java/net/url_class_loader.rs Updates URLClassLoader::findResource directory/jar detection and missing-entry behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs Outdated
Comment thread tests/test_cli.rs
Comment thread src/main.rs
Comment thread src/main.rs Outdated
Comment thread src/main.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 589f73522d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/main.rs Outdated
Comment thread src/main.rs
@dlunch
dlunch merged commit 3296139 into main Jul 19, 2026
10 checks passed
@dlunch
dlunch deleted the agent/cli-classpath branch July 19, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants