|
65 | 65 | * 3. Reference Update phase: |
66 | 66 | * Go through ALL classes and anywhere anything @Value annotated appears, replace it with the corresponding @ConfigurationProperties type. |
67 | 67 | * May involve collapsing multiple arguments into a single argument, updating references to those arguments |
68 | | - * <p> |
69 | 68 | */ |
70 | 69 | @AutoConfigure |
71 | 70 | public class ValueToConfigurationProperties extends JavaRefactorVisitor { |
@@ -225,8 +224,8 @@ private void generateClassesFieldsGettersSetters(J.ClassDecl cd, PrefixTree pt) |
225 | 224 | fieldTypeExpr, |
226 | 225 | fieldName, |
227 | 226 | 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)); |
230 | 229 | } else if(pt instanceof PrefixParentNode) { |
231 | 230 | // Search through any inner class declarations that may exist, use existing declaration if one exists |
232 | 231 | String fieldName = pt.getName(); |
@@ -255,8 +254,8 @@ private void generateClassesFieldsGettersSetters(J.ClassDecl cd, PrefixTree pt) |
255 | 254 | innerClassDecl.getType().getFullyQualifiedName(), |
256 | 255 | fieldName, |
257 | 256 | 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)); |
260 | 259 | // There needs to be a field and getter/setter for the inner class. Any of these may already exist |
261 | 260 |
|
262 | 261 | // Recurse on any children |
@@ -437,7 +436,8 @@ public J visitClassDecl(J.ClassDecl classDecl) { |
437 | 436 | String initializingExpression = node.getInitializingExpression(); |
438 | 437 | J.Assign assignment = (J.Assign) treeBuilder.buildSnippet(getCursor(), |
439 | 438 | "this." + field.getVars().get(0).getSimpleName() + " = " + initializingExpression + ";", |
440 | | - field.getTypeAsClass()).get(0); |
| 439 | + field.getTypeExpr().getType()).get(0); |
| 440 | + |
441 | 441 | // Area to improve: |
442 | 442 | // None of the statements/expressions in the above snippet are going to come out |
443 | 443 | // type-attributed correctly. Which could cause confusion/trouble for visitors coming later |
|
0 commit comments