SONARJAVA-4917 S6857 support property placeholder inside SpEL#5128
SONARJAVA-4917 S6857 support property placeholder inside SpEL#5128erwan-serandour merged 13 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request implements support for property placeholders inside SpEL expressions to address SONARJAVA-4917. Key changes include refactoring the string content checking methods to use a new ParseCtx, introducing new record types (Range, Placeholder, and ParseCtx), and updating error messaging and parsing logic for property placeholders and SpEL expressions.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| java-checks/src/main/java/org/sonar/java/checks/spring/SpelExpressionCheck.java | Refactored parsing logic and error reporting for property placeholders and SpEL expressions using new types and methods. |
| java-checks-test-sources/default/src/main/java/checks/spring/SpelExpressionCheckSample.java | Updated test cases to reflect the new parsing behavior and error messages for property placeholders inside SpEL. |
Files not reviewed (1)
- its/autoscan/src/test/resources/autoscan/diffs/diff_S6857.json: Language not supported
Comments suppressed due to low confidence (2)
java-checks/src/main/java/org/sonar/java/checks/spring/SpelExpressionCheck.java:188
- [nitpick] Consider rephrasing the exception message to improve clarity and grammatical correctness (e.g., 'Range must be non-empty; start value must be less than end value.').
if (start >= end) { throw new IllegalArgumentException("a range is must be non empty, this imply start must be less than end"); }
java-checks-test-sources/default/src/main/java/checks/spring/SpelExpressionCheckSample.java:447
- [nitpick] Consider renaming 'PropertyPlaceHolderInsideSpEL' to 'PropertyPlaceholderInsideSpEL' for consistency in capitalization.
static class PropertyPlaceHolderInsideSpEL {
| throw new SyntaxError("Correct this malformed property placeholder.", range.addOffset(offset)); | ||
| } | ||
| } | ||
| private record ParseCtx(String expressionSource, int offset) { |
There was a problem hiding this comment.
add a bit of doc here, in particular what's the offset
|




SONARJAVA-4917