GROOVY-12153: Fix AstNodeToScriptAdapter decompiler rendering fidelit…#2696
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2696 +/- ##
==================================================
- Coverage 69.1083% 69.1044% -0.0039%
+ Complexity 34235 34234 -1
==================================================
Files 1537 1537
Lines 129310 129355 +45
Branches 23478 23502 +24
==================================================
+ Hits 89364 89390 +26
- Misses 31936 31942 +6
- Partials 8010 8023 +13
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: e14af7c Learn more about TestLens at testlens.app. |
Contributor
There was a problem hiding this comment.
Pull request overview
Improves AstNodeToScriptAdapter’s “decompiler” output so reconstructed source is parseable and round-trips string/GString values more faithfully, addressing GROOVY-12153’s string rendering issues in the Groovy Console AST-to-script view.
Changes:
- Replace naive string literal escaping with a dedicated single-quoted escaping routine that handles backslashes, quotes, and control characters.
- Rework GString rendering to rebuild from
GStringExpressionsegments/values, properly escaping text segments and emitting safer interpolation forms. - Add/expand tests to validate string escaping and GString round-tripping, plus update an existing regex assertion expectation to match the corrected escaping.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstNodeToScriptAdapter.groovy | Fix string and GString rendering by adding correct escaping and reconstructing GStrings from parts instead of decoded text. |
| subprojects/groovy-console/src/test/groovy/groovy/console/ui/AstNodeToScriptAdapterTest.groovy | Add regression tests for string escaping and GString evaluation round-trips; update regex escaping expectation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…y for strings