feat(processor): support no-arg @ServiceProvider via contract inference - #46
feat(processor): support no-arg @ServiceProvider via contract inference#46LMLiam wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughThis PR adds optional contract specification to ChangesService Contract Inference
Build Infrastructure Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
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 docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@gradlew`:
- Around line 134-144: The current for-loop that sets JAVA_HOME only checks
mise-specific candidates and reduces portability; update the fallback logic
around the JAVA_HOME assignment loop to (1) include additional common install
locations (e.g., ~/.sdkman/candidates/java, ~/.asdf/installs/java, /usr/lib/jvm,
/Library/Java/JavaVirtualMachines, /opt/homebrew/opt/openjdk@21) and (2) if none
of those candidates match, attempt to resolve java on PATH (use command -v java
and follow symlinks to infer JAVA_HOME) before failing; modify the loop and the
block that assigns/export JAVA_HOME to search these extra candidate directories
and the PATH-resolve fallback, or alternatively add a clear README note
documenting the mise dependency if you prefer not to expand the search.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 50854f5c-7781-43ff-98fc-67f9626c9bc3
📒 Files selected for processing (5)
gradlewmodules/annotations/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceScheme.ktmodules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.ktmodules/processor/src/test/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessorSpec.ktsettings.gradle
| for candidate in \ | ||
| "$HOME/.local/share/mise/installs/java/21.0.2" \ | ||
| "$HOME/.local/share/mise/installs/java/21.0" \ | ||
| "$HOME/.local/share/mise/installs/java/21" | ||
| do | ||
| if [ -x "$candidate/bin/java" ]; then | ||
| JAVA_HOME=$candidate | ||
| export JAVA_HOME | ||
| break | ||
| fi | ||
| done |
There was a problem hiding this comment.
Hardcoded mise installation paths reduce portability.
The fallback logic searches only mise-specific paths (~/.local/share/mise/installs/java/), which will fail on systems using different Java version managers (SDKMAN, jEnv, asdf, Homebrew, system packages, etc.) or custom installation locations. Consider documenting this mise dependency or broadening the search to include other common Java installation paths.
📝 Potential paths to search across multiple version managers
# Additional common Java installation locations to consider:
# - SDKMAN: ~/.sdkman/candidates/java/
# - asdf: ~/.asdf/installs/java/
# - Homebrew (macOS): /opt/homebrew/opt/openjdk@21
# - System (Linux): /usr/lib/jvm/
# - System (macOS): /Library/Java/JavaVirtualMachines/However, adding all these paths may increase complexity. An alternative is documenting the mise requirement in the project README.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@gradlew` around lines 134 - 144, The current for-loop that sets JAVA_HOME
only checks mise-specific candidates and reduces portability; update the
fallback logic around the JAVA_HOME assignment loop to (1) include additional
common install locations (e.g., ~/.sdkman/candidates/java,
~/.asdf/installs/java, /usr/lib/jvm, /Library/Java/JavaVirtualMachines,
/opt/homebrew/opt/openjdk@21) and (2) if none of those candidates match, attempt
to resolve java on PATH (use command -v java and follow symlinks to infer
JAVA_HOME) before failing; modify the loop and the block that assigns/export
JAVA_HOME to search these extra candidate directories and the PATH-resolve
fallback, or alternatively add a clear README note documenting the mise
dependency if you prefer not to expand the search.
Description
settings.gradleto avoid mandatory plugin resolution during settings evaluation.@ServiceProviderusage by givingServiceProvidera default emptyvalueand implementinginferContractsFromProviderinServiceSchemeProcessorto BFS supertypes and collect@ServiceContractinterfaces; emit a clear compilation error when none can be inferred.ServiceSchemeProcessorSpec.kt.Codex Task
Recreated from #13 — the original PR was auto-closed when
main’s history was rewritten to theverb(scope):convention and GitHub blocks reopening a PR whose branch was force-pushed. Same branch, rebased onto the rewrittenmain.Summary by CodeRabbit
New Features
ServiceProviderannotation now supports optional parameters, with automatic contract inference when contracts are not explicitly specified.Improvements
Tests