Commit 88a8815
GROOVY-12144: Fix AstNodeToScriptAdapter decompiler rendering fidelity
GROOVY_3_0_X backport of master commit 4b27025. Applies the eight
visitor fixes (nested generics, range bounds, elvis, attribute access,
explicit closure arrow, safe index access, numeric literal suffixes,
explicit method type arguments) to both copies of the class on this
branch: groovy.console.ui.AstNodeToScriptAdapter (exercised by the test)
and the legacy duplicate groovy.inspect.swingui.AstNodeToScriptAdapter.
Adaptations for 3.0:
- Range fix uses RangeExpression.isInclusive() and emits the `..<`
right-exclusive form; 3.0 has no left-exclusive range syntax, so the
two left-exclusive cases from master's range test are dropped.
- Safe index access renders `?[`; 3.0 renders VariableExpressions with a
trailing space, so output reads e.g. `list ?[0]` (verified to still
re-parse and re-render as a safe index).
Adds one regression test per defect (GroovyTestCase style). Reconciles
existing tests to the branch's corrected output: testTernaryOperaters
(elvis), testGenericsInMethods (nested generics now preserved),
testLogAnnotation (@log's Level.FINE AttributeExpression now renders
.@fine).
Assisted-by: Claude Code (Opus 4.8)1 parent 63903d9 commit 88a8815
3 files changed
Lines changed: 130 additions & 12 deletions
File tree
- subprojects/groovy-console/src
- main/groovy/groovy
- console/ui
- inspect/swingui
- test/groovy/groovy/console/ui
Lines changed: 28 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
394 | 397 | | |
395 | 398 | | |
396 | 399 | | |
| |||
692 | 695 | | |
693 | 696 | | |
694 | 697 | | |
| 698 | + | |
695 | 699 | | |
696 | 700 | | |
697 | 701 | | |
| |||
728 | 732 | | |
729 | 733 | | |
730 | 734 | | |
731 | | - | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
732 | 740 | | |
733 | 741 | | |
734 | 742 | | |
| |||
759 | 767 | | |
760 | 768 | | |
761 | 769 | | |
| 770 | + | |
| 771 | + | |
762 | 772 | | |
763 | 773 | | |
764 | 774 | | |
| |||
792 | 802 | | |
793 | 803 | | |
794 | 804 | | |
795 | | - | |
| 805 | + | |
796 | 806 | | |
797 | 807 | | |
798 | 808 | | |
| |||
805 | 815 | | |
806 | 816 | | |
807 | 817 | | |
808 | | - | |
| 818 | + | |
809 | 819 | | |
810 | 820 | | |
811 | 821 | | |
| |||
830 | 840 | | |
831 | 841 | | |
832 | 842 | | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
833 | 855 | | |
834 | 856 | | |
835 | 857 | | |
| |||
1031 | 1053 | | |
1032 | 1054 | | |
1033 | 1055 | | |
1034 | | - | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
1035 | 1059 | | |
1036 | 1060 | | |
1037 | 1061 | | |
| |||
Lines changed: 28 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
403 | 406 | | |
404 | 407 | | |
405 | 408 | | |
| |||
701 | 704 | | |
702 | 705 | | |
703 | 706 | | |
| 707 | + | |
704 | 708 | | |
705 | 709 | | |
706 | 710 | | |
| |||
737 | 741 | | |
738 | 742 | | |
739 | 743 | | |
740 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
741 | 749 | | |
742 | 750 | | |
743 | 751 | | |
| |||
769 | 777 | | |
770 | 778 | | |
771 | 779 | | |
| 780 | + | |
| 781 | + | |
772 | 782 | | |
773 | 783 | | |
774 | 784 | | |
| |||
802 | 812 | | |
803 | 813 | | |
804 | 814 | | |
805 | | - | |
| 815 | + | |
806 | 816 | | |
807 | 817 | | |
808 | 818 | | |
| |||
815 | 825 | | |
816 | 826 | | |
817 | 827 | | |
818 | | - | |
| 828 | + | |
819 | 829 | | |
820 | 830 | | |
821 | 831 | | |
| |||
840 | 850 | | |
841 | 851 | | |
842 | 852 | | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
843 | 865 | | |
844 | 866 | | |
845 | 867 | | |
| |||
1043 | 1065 | | |
1044 | 1066 | | |
1045 | 1067 | | |
1046 | | - | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1047 | 1071 | | |
1048 | 1072 | | |
1049 | 1073 | | |
| |||
Lines changed: 74 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
| 162 | + | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
709 | 710 | | |
710 | 711 | | |
711 | 712 | | |
712 | | - | |
| 713 | + | |
713 | 714 | | |
714 | 715 | | |
715 | 716 | | |
| |||
984 | 985 | | |
985 | 986 | | |
986 | 987 | | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
987 | 1057 | | |
0 commit comments