fix(processor): suppress missing @ServiceProvider error when no providers exist - #45
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughThis PR refines the SPI processor's implementation validation logic to be more precise about concrete class filtering, then bumps the version to 0.1.23. The processor now skips interfaces, abstract classes, and Kotlin synthetic helpers before validating contract assignability and ChangesValidation and Release Updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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
`@modules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.kt`:
- Around line 106-108: The current filter in ServiceSchemeProcessor uses
clazz.simpleName == "DefaultImpls" which incorrectly excludes real user classes
named "DefaultImpls"; update the check to inspect the class binary name and only
skip when the binary name ends with "$DefaultImpls" (e.g., use clazz.name or
binary-name equivalent and test endsWith("$DefaultImpls")) so nested/synthetic
helper classes are filtered but real top-level classes named DefaultImpls are
not; keep the surrounding comment and ensure the condition is applied where
clazz and simple are used (replace the simple == "DefaultImpls" check).
🪄 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: 1c306811-19ad-4fbb-8384-1d950a490fca
📒 Files selected for processing (2)
gradle.propertiesmodules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.kt
| // Skip common Kotlin synthetic helper classes, but DO NOT skip nested user classes | ||
| val simple = clazz.simpleName.toString() | ||
| if (simple == "DefaultImpls") return@forEach |
There was a problem hiding this comment.
Narrow the synthetic-class filter to binary-name pattern, not simple name.
At Line 108, simple == "DefaultImpls" can skip real user classes named DefaultImpls, which suppresses required missing-@ServiceProvider errors. Filter by binary name suffix (e.g., "$DefaultImpls") instead.
Proposed fix
- val simple = clazz.simpleName.toString()
- if (simple == "DefaultImpls") return@forEach
+ val binaryName = processingEnv.getStringifiedBinaryName(clazz)
+ if (binaryName.endsWith("\$DefaultImpls")) return@forEach🤖 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
`@modules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.kt`
around lines 106 - 108, The current filter in ServiceSchemeProcessor uses
clazz.simpleName == "DefaultImpls" which incorrectly excludes real user classes
named "DefaultImpls"; update the check to inspect the class binary name and only
skip when the binary name ends with "$DefaultImpls" (e.g., use clazz.name or
binary-name equivalent and test endsWith("$DefaultImpls")) so nested/synthetic
helper classes are filtered but real top-level classes named DefaultImpls are
not; keep the surrounding comment and ensure the condition is applied where
clazz and simple are used (replace the simple == "DefaultImpls" check).
📌 Summary
🔍 Related Issues / Tickets
🛠 Changes in Detail
🧩 Modules Affected
📦 Versioning
🧪 Testing
1.
2.
✅ Checklist
./gradlew kotest)📜 Notes for Reviewers
Recreated from #12 — 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
Chores
Bug Fixes