Commit c691c9f
authored
Adopt upstream XML trailing-comment formatting (#1180)
* Adopt upstream XML trailing-comment formatting
openrewrite/rewrite#8353 made XML auto-format keep a comment on the same
line as the element it trails, instead of reflowing it onto its own line.
`AddMockitoJavaAgentToMavenSurefirePlugin` relied on that reflow: when its
`<argLine>` is appended into an existing `<configuration>`, the accompanying
`<!--suppress MavenModelInspection -->` is no longer the first content of the
tag, so it stayed glued to the preceding sibling and read as annotating that
element rather than the `<argLine>` below it. Seed the comment with a newline
prefix so auto-format keeps it on its own line either way.
`JpaCachePropertiesTest` expectations reflowed comments that the input had
placed on the same line; they now assert the input's own placement.
* Revert JpaCachePropertiesTest expectations to own-line comments
Restores the pre-existing expectations, which assert that auto-format moves
a trailing comment onto its own line. All 20 cases fail against the current
rewrite snapshot: openrewrite/rewrite#8353 now keeps such comments on the
line of the element they trail.
Leaving the expectations as the desired behaviour rather than absorbing the
new output into the test. Red until the formatting is addressed.
* Route JpaCacheProperties removals through RemoveContentVisitor
openrewrite/rewrite#8355 taught `RemoveContentVisitor` to hand a removed
element's prefix to a comment that trailed it, so the comment keeps its own
line instead of collapsing onto the preceding sibling. `JpaCacheProperties`
removed via `filterTagChildren`, which drops content outright and so never
saw that fix; switching the two single-element removals over picks it up and
restores the original expectations for 13 of the 20 cases.
The remaining 7 remove nothing: the element the comment trails is retained
(or merely has an attribute updated), so #8353 now faithfully reproduces the
inline placement the input used. Those expectations were asserting the old
reflow and are updated to match the source.1 parent 908a523 commit c691c9f
3 files changed
Lines changed: 22 additions & 22 deletions
File tree
- src
- main/java/org/openrewrite/java/migrate
- test/java/org/openrewrite/java/migrate
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
202 | 210 | | |
203 | 211 | | |
204 | 212 | | |
| |||
Lines changed: 9 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
611 | | - | |
| 610 | + | |
612 | 611 | | |
613 | 612 | | |
614 | 613 | | |
| |||
644 | 643 | | |
645 | 644 | | |
646 | 645 | | |
647 | | - | |
648 | | - | |
| 646 | + | |
649 | 647 | | |
650 | 648 | | |
651 | 649 | | |
| |||
681 | 679 | | |
682 | 680 | | |
683 | 681 | | |
684 | | - | |
685 | | - | |
| 682 | + | |
686 | 683 | | |
687 | 684 | | |
688 | 685 | | |
| |||
783 | 780 | | |
784 | 781 | | |
785 | 782 | | |
786 | | - | |
787 | | - | |
| 783 | + | |
788 | 784 | | |
789 | 785 | | |
790 | 786 | | |
| |||
909 | 905 | | |
910 | 906 | | |
911 | 907 | | |
912 | | - | |
913 | | - | |
| 908 | + | |
914 | 909 | | |
915 | 910 | | |
916 | 911 | | |
917 | 912 | | |
918 | | - | |
919 | | - | |
| 913 | + | |
920 | 914 | | |
921 | 915 | | |
922 | 916 | | |
| |||
947 | 941 | | |
948 | 942 | | |
949 | 943 | | |
950 | | - | |
951 | | - | |
| 944 | + | |
952 | 945 | | |
953 | 946 | | |
954 | 947 | | |
955 | 948 | | |
956 | | - | |
957 | | - | |
| 949 | + | |
958 | 950 | | |
959 | 951 | | |
960 | 952 | | |
| |||
1139 | 1131 | | |
1140 | 1132 | | |
1141 | 1133 | | |
1142 | | - | |
1143 | | - | |
| 1134 | + | |
1144 | 1135 | | |
1145 | 1136 | | |
1146 | 1137 | | |
| |||
0 commit comments