diff options
author | Kay Schubert <kay.schubert@datameer.com> | 2020-08-17 15:57:45 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-08-27 23:52:32 +0200 |
commit | edbfdfe8c52c17a38bf2b526d14a4f622c5402f7 (patch) | |
tree | f61485196347a7f5f32438e2557686673a3376a8 /src/core | |
parent | 60a9799c24f182b3c7e262754b6cc2e3400a4993 (diff) | |
download | lombok-edbfdfe8c52c17a38bf2b526d14a4f622c5402f7.tar.gz lombok-edbfdfe8c52c17a38bf2b526d14a4f622c5402f7.tar.bz2 lombok-edbfdfe8c52c17a38bf2b526d14a4f622c5402f7.zip |
Issue 2552 - generate class initializer body only after field member injection
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java b/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java index 9343011f..cee3912c 100644 --- a/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java +++ b/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java @@ -171,10 +171,10 @@ public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldName injectMethod(fieldsType, constructor); } + Clinit cli = null; if (genClinit) { - Clinit cli = new Clinit(parent.compilationResult); + cli = new Clinit(parent.compilationResult); injectMethod(fieldsType, cli); - cli.traverse(generatedByVisitor, ((TypeDeclaration) fieldsType.get()).scope); } for (EclipseNode fieldNode : fields) { @@ -202,5 +202,9 @@ public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldName injectField(fieldsType, constantField); constantField.traverse(generatedByVisitor, ((TypeDeclaration) fieldsType.get()).initializerScope); } + + if (genClinit) { + cli.traverse(generatedByVisitor, ((TypeDeclaration) fieldsType.get()).scope); + } } } |