Skip to content

Commit 2dc4c2a

Browse files
committed
Polish
1 parent e587300 commit 2dc4c2a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rewrite-java/src/main/java/org/openrewrite/java/AddOrUpdateAnnotationAttribute.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ public J.Annotation visitAnnotation(J.Annotation original, ExecutionContext ctx)
111111
return JavaTemplate
112112
.apply("#{}", getCursor(), a.getCoordinates().replaceArguments(), newAttributeValue);
113113
}
114-
String x = newAttributeValue.contains(",") && attributeIsArray(a) ? getAttributeValuesAsString() : newAttributeValue;
114+
String attrVal = newAttributeValue.contains(",") && attributeIsArray(a) ? getAttributeValuesAsString() : newAttributeValue;
115115
return JavaTemplate
116-
.apply("#{} = #{}", getCursor(), a.getCoordinates().replaceArguments(), attributeName, x);
116+
.apply("#{} = #{}", getCursor(), a.getCoordinates().replaceArguments(), attributeName, attrVal);
117117
}
118118

119119
// UPDATE the value when the annotation has arguments, e.g. @Foo(name="old") to `@Foo(name="new")
@@ -199,10 +199,10 @@ public J.Annotation visitAnnotation(J.Annotation original, ExecutionContext ctx)
199199
if (!valueMatches(fieldAccess, oldAttributeValue) || newAttributeValue.equals(fieldAccess.toString())) {
200200
return fieldAccess;
201201
}
202-
String x = newAttributeValue.contains(",") && attributeIsArray(annotation) ? getAttributeValues().stream().map(String::valueOf).collect(joining(",", "{", "}")) : newAttributeValue;
202+
String attrVal = newAttributeValue.contains(",") && attributeIsArray(annotation) ? getAttributeValues().stream().map(String::valueOf).collect(joining(",", "{", "}")) : newAttributeValue;
203203
//noinspection ConstantConditions
204204
return ((J.Annotation) JavaTemplate
205-
.apply("#{}", getCursor(), annotation.getCoordinates().replaceArguments(), x))
205+
.apply("#{}", getCursor(), annotation.getCoordinates().replaceArguments(), attrVal))
206206
.getArguments().get(0);
207207
}
208208
// Make the attribute name explicit, before we add the new value below
@@ -220,10 +220,10 @@ public J.Annotation visitAnnotation(J.Annotation original, ExecutionContext ctx)
220220
}
221221

222222
private Expression createAnnotationLiteral(J.Annotation annotation, String newAttributeValue) {
223-
String x = newAttributeValue.contains(",") && attributeIsArray(annotation) ? getAttributeValuesAsString() : newAttributeValue;
223+
String attrVal = newAttributeValue.contains(",") && attributeIsArray(annotation) ? getAttributeValuesAsString() : newAttributeValue;
224224
//noinspection ConstantConditions
225225
return ((J.Annotation) JavaTemplate
226-
.apply("#{}", getCursor(), annotation.getCoordinates().replaceArguments(), x))
226+
.apply("#{}", getCursor(), annotation.getCoordinates().replaceArguments(), attrVal))
227227
.getArguments().get(0);
228228
}
229229

0 commit comments

Comments
 (0)