Commit fd8e2bf
authored
Walk JavaType refs embedded in annotation element values (#7426)
JavaTypeVisitor.visitAnnotation only visited annotation.getType(),
leaving any JavaType refs in element values untouched: the element
meta-variable, SingleElementValue.referenceValue,
SingleElementValue.constantValue (when it's a JavaType), and
ArrayElementValue's referenceValues / JavaType-valued constantValues.
Downstream visitors that rely on the full-graph walk (dedup, type
remappers, serializers) silently see non-canonical instances inside
annotation values while the rest of the type graph is consistent.
Adds visitAnnotationElementValue, which visits every ref kind and
reconstructs the ElementValue only when a returned instance differs.
UnsafeJavaTypeVisitor inherits this via the default visitAnnotation.1 parent a6a8b25 commit fd8e2bf
2 files changed
Lines changed: 49 additions & 1 deletion
File tree
- rewrite-benchmarks
- rewrite-java/src/main/java/org/openrewrite/java
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
Lines changed: 48 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
121 | 168 | | |
122 | 169 | | |
123 | 170 | | |
| |||
0 commit comments