Skip to content

Commit c29df8b

Browse files
committed
Update for compatibility with changed signatures of GenerateGetter/Setter
1 parent b50743a commit c29df8b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/openrewrite/java/spring/boot2/ValueToConfigurationProperties.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
* 3. Reference Update phase:
6666
* Go through ALL classes and anywhere anything @Value annotated appears, replace it with the corresponding @ConfigurationProperties type.
6767
* May involve collapsing multiple arguments into a single argument, updating references to those arguments
68-
* <p>
6968
*/
7069
@AutoConfigure
7170
public class ValueToConfigurationProperties extends JavaRefactorVisitor {
@@ -225,8 +224,8 @@ private void generateClassesFieldsGettersSetters(J.ClassDecl cd, PrefixTree pt)
225224
fieldTypeExpr,
226225
fieldName,
227226
null));
228-
andThen(new GenerateGetter.Scoped(cd.getType(), fieldName));
229-
andThen(new GenerateSetter.Scoped(cd.getType(), fieldName));
227+
andThen(new GenerateGetter.Scoped(cd, fieldName));
228+
andThen(new GenerateSetter.Scoped(cd, fieldName));
230229
} else if(pt instanceof PrefixParentNode) {
231230
// Search through any inner class declarations that may exist, use existing declaration if one exists
232231
String fieldName = pt.getName();
@@ -255,8 +254,8 @@ private void generateClassesFieldsGettersSetters(J.ClassDecl cd, PrefixTree pt)
255254
innerClassDecl.getType().getFullyQualifiedName(),
256255
fieldName,
257256
null));
258-
andThen(new GenerateGetter.Scoped(cd.getType(), fieldName));
259-
andThen(new GenerateSetter.Scoped(cd.getType(), fieldName));
257+
andThen(new GenerateGetter.Scoped(cd, fieldName));
258+
andThen(new GenerateSetter.Scoped(cd, fieldName));
260259
// There needs to be a field and getter/setter for the inner class. Any of these may already exist
261260

262261
// Recurse on any children
@@ -437,7 +436,8 @@ public J visitClassDecl(J.ClassDecl classDecl) {
437436
String initializingExpression = node.getInitializingExpression();
438437
J.Assign assignment = (J.Assign) treeBuilder.buildSnippet(getCursor(),
439438
"this." + field.getVars().get(0).getSimpleName() + " = " + initializingExpression + ";",
440-
field.getTypeAsClass()).get(0);
439+
field.getTypeExpr().getType()).get(0);
440+
441441
// Area to improve:
442442
// None of the statements/expressions in the above snippet are going to come out
443443
// type-attributed correctly. Which could cause confusion/trouble for visitors coming later

0 commit comments

Comments
 (0)