Skip to content

Conversation

@javier-godoy
Copy link
Member

@javier-godoy javier-godoy commented Nov 17, 2025

Summary by CodeRabbit

  • Refactor
    • Refactored method invocation patterns across components to leverage extension method capabilities, maintaining all existing public APIs and functionality.

@javier-godoy javier-godoy requested a review from paodb November 17, 2025 12:55
@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Walkthrough

Two Java demo classes are modified to integrate Lombok's ExtensionMethod annotation, enabling extension method support for JsonMigration. Static method calls are replaced with instance-style equivalents. No changes to public API signatures.

Changes

Cohort / File(s) Summary
Lombok ExtensionMethod Integration
src/main/java/com/flowingcode/vaadin/addons/demo/MultiSourceCodeViewer.java, src/main/java/com/flowingcode/vaadin/addons/demo/SourceCodeViewer.java
Adds @ExtensionMethod(value = JsonMigration.class, suppressBaseMethods = true) annotation and imports lombok.experimental.ExtensionMethod. Replaces static JsonMigration method invocations with instance-style extension method calls (e.g., ev.getEventData() instead of JsonMigration.getEventData(ev)).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Homogeneous changes applied consistently across both files (same annotation pattern and method call replacement)
  • Low logic density; straightforward refactoring with no structural changes
  • No alterations to public APIs or method signatures
  • Verify that the extension method annotation is correctly configured and that the static-to-instance method call replacements are syntactically correct

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: refactoring code to use Lombok's extension mechanism for cleaner syntax across two files.
✨ 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 lombok-refactor

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.

@sonarqubecloud
Copy link

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: 1

♻️ Duplicate comments (1)
src/main/java/com/flowingcode/vaadin/addons/demo/SourceCodeViewer.java (1)

36-40: Same suppressBaseMethods concern applies here.

This file uses the same @ExtensionMethod configuration as MultiSourceCodeViewer.java. The verification requested in that file applies here as well - ensure that Element doesn't have a native setPropertyJson method that would be shadowed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 423234f and 0e65057.

📒 Files selected for processing (2)
  • src/main/java/com/flowingcode/vaadin/addons/demo/MultiSourceCodeViewer.java (2 hunks)
  • src/main/java/com/flowingcode/vaadin/addons/demo/SourceCodeViewer.java (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/flowingcode/vaadin/addons/demo/SourceCodeViewer.java (2)
src/main/java/com/flowingcode/vaadin/addons/demo/MultiSourceCodeViewer.java (1)
  • ExtensionMethod (33-151)
src/main/java/com/flowingcode/vaadin/addons/demo/SplitLayoutDemo.java (1)
  • SuppressWarnings (32-114)
🔇 Additional comments (2)
src/main/java/com/flowingcode/vaadin/addons/demo/SourceCodeViewer.java (1)

91-91: LGTM - Consistent with the refactoring pattern.

The change from JsonMigration.setPropertyJson(codeViewer, "env", env) to codeViewer.setPropertyJson("env", env) maintains consistency with the extension method approach. The refactoring successfully eliminates static method calls in favor of more fluent instance-style syntax.

src/main/java/com/flowingcode/vaadin/addons/demo/MultiSourceCodeViewer.java (1)

31-33: Verify that extension methods from json-migration-helper are intentionally shadowing Vaadin's existing methods.

The getEventData() method exists in Vaadin Flow's DomEvent class and returns a JsonObject containing client-side event data. Similarly, Element.setPropertyJson() is a standard method in Vaadin Flow that sets a DOM property to a JSON value.

With suppressBaseMethods = true, the extension methods from json-migration-helper will override these existing Vaadin methods at lines 52 (ev.getEventData()) and 91 (codeViewer.setPropertyJson()). Confirm that:

  1. The extension methods provide compatible implementations (same behavior or intentional enhancements)
  2. The shadowing is intentional and necessary for the json-migration-helper functionality
  3. The code has been tested to ensure the extension methods work correctly in place of the Vaadin originals

@paodb paodb merged commit 9e9f1e8 into master Nov 17, 2025
3 checks passed
@paodb paodb deleted the lombok-refactor branch November 17, 2025 13:50
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.

3 participants