You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "leonard84 (via GitHub)" <gi...@apache.org> on 2026/07/10 12:33:24 UTC

[PR] GROOVY-12144: Fix AstNodeToScriptAdapter decompiler rendering fidelity (GROOVY_5_0_X backport) [groovy]

leonard84 opened a new pull request, #2684:
URL: https://github.com/apache/groovy/pull/2684

   This backports the eight decompiler-fidelity fixes from master (#2682, commit `4b27025962`) to `GROOVY_5_0_X`. `AstNodeToScriptVisitor` rendered several constructs so they did not round-trip; each fix is localized to one visitor method:
   
   1. Nested generic type arguments dropped (`Map<String, List<Integer>>` → `Map<String, List>`) — `visitGenerics` recurses into concrete args.
   2. Range bound exclusions dropped — `visitRangeExpression`.
   3. Elvis rendered as a duplicated ternary (`c ?: d` → `c ? c : d`, evaluating `c` twice) — `visitShortTernaryExpression` emits `?:`.
   4. Attribute access lost the at-sign (`obj.@f` → `obj.f`) — `visitPropertyExpression` emits `.@` for an `AttributeExpression`.
   5. Explicit zero-arg closures lost the arrow (`{ -> ... }` → `{ ... }`) — `visitClosureExpression` distinguishes a null parameter list from `Parameter.EMPTY_ARRAY`.
   6. Safe index access lost safe navigation (`list?[0]` → `list[0]`) — `visitBinaryExpression`.
   7. Numeric literal type suffixes dropped (`42L/2.5f/3.5d/10G`) — `visitConstantExpression` re-appends `L/F/D/G`.
   8. Explicit method-call type arguments dropped (`Collections.<String>emptyList()`) — `visitMethodCallExpression`.
   
   One regression test per defect (GroovyTestCase style, matching the existing test class). Existing tests reconciled to the corrected output: `testTernaryOperaters` (elvis), `testGenericsInMethods` (nested generics now preserved), `testLogAnnotation` (`@Log`'s `Level.FINE` is an `AttributeExpression`, now renders `Level.@FINE`).
   
   **Fixes apply as-is** — all APIs present on 5.0.
   
   **Tests:** `:groovy-console:test` green; `AstNodeToScriptAdapterTest` 71/71 (validated with a forced `--no-build-cache --rerun-tasks` recompile+run).
   
   Master PR: https://github.com/apache/groovy/pull/2682
   
   ---
   🤖 Prepared with Claude Code (Opus 4.8) on behalf of @leonard84.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12144: Fix AstNodeToScriptAdapter decompiler rendering fidelity (GROOVY_5_0_X backport) [groovy]

Posted by "daniellansun (via GitHub)" <gi...@apache.org>.
daniellansun merged PR #2684:
URL: https://github.com/apache/groovy/pull/2684


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12144: Fix AstNodeToScriptAdapter decompiler rendering fidelity (GROOVY_5_0_X backport) [groovy]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2684:
URL: https://github.com/apache/groovy/pull/2684#issuecomment-4939550477

   ## [Codecov](https://app.codecov.io/gh/apache/groovy/pull/2684?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `76.19048%` with `5 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 67.2451%. Comparing base ([`ee772e0`](https://app.codecov.io/gh/apache/groovy/commit/ee772e01f546b3961020581bb064a1f4e3df40fc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`3a4bd6d`](https://app.codecov.io/gh/apache/groovy/commit/3a4bd6dbe68fd05bb51f31133b03c9b06430234d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2684?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...vy/groovy/console/ui/AstNodeToScriptAdapter.groovy](https://app.codecov.io/gh/apache/groovy/pull/2684?src=pr&el=tree&filepath=subprojects%2Fgroovy-console%2Fsrc%2Fmain%2Fgroovy%2Fgroovy%2Fconsole%2Fui%2FAstNodeToScriptAdapter.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWNvbnNvbGUvc3JjL21haW4vZ3Jvb3Z5L2dyb292eS9jb25zb2xlL3VpL0FzdE5vZGVUb1NjcmlwdEFkYXB0ZXIuZ3Jvb3Z5) | 76.1905% | [0 Missing and 5 partials :warning: ](https://app.codecov.io/gh/apache/groovy/pull/2684?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/groovy/pull/2684/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2684?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                  Coverage Diff                   @@
   ##             GROOVY_5_0_X      #2684        +/-   ##
   ======================================================
   - Coverage         67.2477%   67.2451%   -0.0027%     
   + Complexity          29571      29568         -3     
   ======================================================
     Files                1382       1382                
     Lines              116972     116990        +18     
     Branches            20539      20551        +12     
   ======================================================
   + Hits                78661      78670         +9     
   - Misses              31788      31792         +4     
   - Partials             6523       6528         +5     
   ```
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2684?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...vy/groovy/console/ui/AstNodeToScriptAdapter.groovy](https://app.codecov.io/gh/apache/groovy/pull/2684?src=pr&el=tree&filepath=subprojects%2Fgroovy-console%2Fsrc%2Fmain%2Fgroovy%2Fgroovy%2Fconsole%2Fui%2FAstNodeToScriptAdapter.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWNvbnNvbGUvc3JjL21haW4vZ3Jvb3Z5L2dyb292eS9jb25zb2xlL3VpL0FzdE5vZGVUb1NjcmlwdEFkYXB0ZXIuZ3Jvb3Z5) | `71.4932% <76.1905%> (+0.1754%)` | :arrow_up: |
   
   ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/apache/groovy/pull/2684/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12144: Fix AstNodeToScriptAdapter decompiler rendering fidelity (GROOVY_5_0_X backport) [groovy]

Posted by "daniellansun (via GitHub)" <gi...@apache.org>.
daniellansun commented on PR #2684:
URL: https://github.com/apache/groovy/pull/2684#issuecomment-4941474246

   Merged. Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org