Skip to content

Conversation

@skydoves
Copy link
Owner

@skydoves skydoves commented Nov 27, 2025

Fix extracting raw FQ name from the property's getter. (#67)

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced stability analysis for Kotlin properties: The compiler now correctly processes property getters with improved pattern detection, name extraction, and qualified name resolution. This ensures more accurate and reliable stability checking for property-based code structures and improves overall analysis correctness.

✏️ Tip: You can customize this high-level summary in your review settings.

@skydoves skydoves self-assigned this Nov 27, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 27, 2025

Walkthrough

The change adds property getter detection logic to the StabilityAnalyzerTransformer. When analyzing function names, the code now identifies getter patterns like "", extracts the actual property name, and corrects the fully-qualified name accordingly before proceeding with annotation and stability analysis.

Changes

Cohort / File(s) Summary
Property Getter Handling
stability-compiler/src/main/kotlin/com/skydoves/compose/stability/compiler/lower/StabilityAnalyzerTransformer.kt
Added logic to detect Kotlin property getter syntax ("<get-...>") in function names within visitFunctionNew, extract the underlying property name, and normalize the fully-qualified name by replacing getter patterns with actual property names for downstream annotation and stability analysis

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus areas: Verify the regex or string matching logic correctly identifies and extracts property names from the getter pattern
  • Consideration: Ensure the corrected functionName and fqName are used consistently in all subsequent operations that depend on them

Poem

🐰 Getters hiding in angle brackets deep,
We'll unmask the properties they keep,
From "<get-" we extract the name,
Stability analysis stays the same!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal and lacks required sections from the template (Goal, Implementation details, examples, and preparation instructions). Add detailed explanation of the bug being fixed, implementation approach, code examples, and confirmation of running spotlessApply and apiDump commands.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing the extraction of fully-qualified names from property getters in the Kotlin compiler.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/extract-properties-getter

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
stability-compiler/src/main/kotlin/com/skydoves/compose/stability/compiler/lower/StabilityAnalyzerTransformer.kt (1)

64-86: Getter name/FQN normalization looks correct; consider IR-based detection and minor cleanups

The new logic correctly:

  • Detects getter functions via "<get-"/">" name check.
  • Extracts the property name with substring(5, rawFunctionName.length - 1).
  • Rewrites the FQN by stripping <get-...> so qualifiedName and simpleName now reflect the property instead of the accessor, which should fix the original bug for @Composable property getters and improve TraceRecomposition tagging.

Two optional refinements to consider:

  • Prefer IR metadata over string patterns for robustness: e.g., declaration.correspondingPropertySymbol?.owner?.name?.asString() (or equivalent in your Kotlin/IR version) to get the property name instead of parsing "<get-...>". That avoids assumptions about synthetic name shapes and should stay stable across compiler changes.
  • Hoist the regex to a private constant to avoid re-instantiating it for every function:
    private val getterNameRegex = Regex("<get-([^>]+)>")
    ...
    val propertyFqName = if (rawFqName.contains("<get-")) {
        rawFqName.replace(getterNameRegex, "$1")
    } else {
        rawFqName
    }

You could also slightly simplify the mapping with destructuring:

val (functionName, fqName) =
  if (rawFunctionName.startsWith("<get-") && rawFunctionName.endsWith(">")) { ... } else {
    rawFunctionName to rawFqName
  }

Please also verify this behaves as expected for:

  • Extension property getters annotated with @Composable.
  • Any cases where the compiler might change the synthetic getter naming scheme in future Kotlin versions.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c56914 and ef56f28.

📒 Files selected for processing (1)
  • stability-compiler/src/main/kotlin/com/skydoves/compose/stability/compiler/lower/StabilityAnalyzerTransformer.kt (1 hunks)

@skydoves skydoves merged commit 2ab4a72 into main Nov 27, 2025
10 checks passed
@skydoves skydoves deleted the fix/extract-properties-getter branch November 27, 2025 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants