Bugfix/#138 resolve ambiguity with wrap method in preview wrapper - #139
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe scanner now selects ChangesWrap method matching
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
core/src/main/java/sergio/sastre/composable/preview/scanner/core/preview/ComposablePreview.kt (1)
110-115: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winValidate the
Wrapthird parameter in the predicate.The scanner expects
Wrap(Function2, Composer, Int), but the current filter accepts any third type. PassIntfor change tracking, so an overload such asWrap(Function2, Composer, String)can fail atwrapMethod.invoke(...). Include the third-type check instead of relying on the cache comment.🤖 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 `@core/src/main/java/sergio/sastre/composable/preview/scanner/core/preview/ComposablePreview.kt` around lines 110 - 115, Update the `Wrap` method predicate in `ComposablePreview` to validate that the third parameter type is `Int` in addition to the existing name, count, and first two parameter checks, ensuring only `Wrap(Function2, Composer, Int)` is selected.
🤖 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
`@core/src/main/java/sergio/sastre/composable/preview/scanner/core/preview/ComposablePreview.kt`:
- Around line 110-115: Update the Wrap method lookup in PreviewWrapperCache to
uniquely select the intended overload using the exact third parameter type (or
reject ambiguous matches), rather than relying on declaredMethods order;
preserve invocation with the expected content, composer, and changed arguments,
and add a runtime regression assertion confirming PublicScaffoldWrapper
succeeds.
In
`@tests/src/main/java/sergio/sastre/composable/preview/scanner/android/previewwrapper/Composables.kt`:
- Around line 45-49: Update the lookalike Wrap fixture in Composables.kt to be
non-@Composable and use a descriptor such as (Function2, String), ensuring it
remains a three-parameter reflection match without compiler-generated
parameters. Preserve the existing overriding Wrap selection behavior and revise
the misleading bytecode comment accordingly.
---
Nitpick comments:
In
`@core/src/main/java/sergio/sastre/composable/preview/scanner/core/preview/ComposablePreview.kt`:
- Around line 110-115: Update the `Wrap` method predicate in `ComposablePreview`
to validate that the third parameter type is `Int` in addition to the existing
name, count, and first two parameter checks, ensuring only `Wrap(Function2,
Composer, Int)` is selected.
🪄 Autofix
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: CHILL
Plan: Pro Plus
Run ID: cb46cbbc-8225-42cd-8dc8-b8b7ae506cdb
📒 Files selected for processing (2)
core/src/main/java/sergio/sastre/composable/preview/scanner/core/preview/ComposablePreview.kttests/src/main/java/sergio/sastre/composable/preview/scanner/android/previewwrapper/Composables.kt
Summary by CodeRabbit
Wrapmethods.