-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: remove use of lang3 trimToNull #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a package-local Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
🔇 Additional comments (3)
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.
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)
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java (1)
36-64: Make the utility class non‑instantiable (and optionallyfinal)Since this is a pure static utility class, Sonar is right that exposing an implicit public no‑arg constructor is unnecessary. Making the class non‑instantiable also documents intent.
Consider:
-class StringUtils { +final class StringUtils { + + private StringUtils() { + // Utility class; do not instantiate. + }This will satisfy the Sonar warning and follows common Java utility‑class conventions.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelperClassNameGenerator.java(0 hunks)src/main/java/com/flowingcode/vaadin/addons/gridhelpers/HeaderFooterStylesHelper.java(0 hunks)src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java(1 hunks)
💤 Files with no reviewable changes (2)
- src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelperClassNameGenerator.java
- src/main/java/com/flowingcode/vaadin/addons/gridhelpers/HeaderFooterStylesHelper.java
🧰 Additional context used
🪛 GitHub Check: SonarCloud Code Analysis
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java
[warning] 36-36: Add a private constructor to hide the implicit public one.
🔇 Additional comments (1)
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java (1)
38-62:trimToNullimplementation correctly mirrors the intended behaviorThe null check,
trim(), and empty‑to‑null handling give you the same semantics as the original Apache CommonsStringUtils.trimToNull, so this is a safe local replacement for the removed dependency.
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java
Show resolved
Hide resolved
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelperClassNameGenerator.java(0 hunks)src/main/java/com/flowingcode/vaadin/addons/gridhelpers/HeaderFooterStylesHelper.java(0 hunks)src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java(1 hunks)
💤 Files with no reviewable changes (2)
- src/main/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelperClassNameGenerator.java
- src/main/java/com/flowingcode/vaadin/addons/gridhelpers/HeaderFooterStylesHelper.java
🔇 Additional comments (2)
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java (2)
22-22: LGTM: @UtilityClass annotation addresses constructor visibility.The use of Lombok's
@UtilityClassannotation automatically makes the constructor private and the class final, which addresses the concern raised in the previous review about constructor visibility.Also applies to: 39-40
57-66: LGTM: Implementation logic is correct and verified.The
trimToNullimplementation correctly handles null input, trims whitespace, and returns null for empty strings. The logic matches the documented behavior.Verification confirms:
- ✓ All production code call sites (GridHelperClassNameGenerator, HeaderFooterStylesHelper) correctly resolve to the local StringUtils class
- ✓ Lombok dependency is declared in pom.xml
- ✓ The commons-lang3 import remaining in LazyTestData.java (test file) is only used for
containsIgnoreCase(), nottrimToNull, so this does not impact the change
src/main/java/com/flowingcode/vaadin/addons/gridhelpers/StringUtils.java
Outdated
Show resolved
Hide resolved
|



Close #149
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.