aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java
diff options
context:
space:
mode:
authorKay Schubert <kay.schubert@datameer.com>2020-08-17 15:57:45 +0200
committerRoel Spilker <r.spilker@gmail.com>2020-08-27 23:52:32 +0200
commitedbfdfe8c52c17a38bf2b526d14a4f622c5402f7 (patch)
treef61485196347a7f5f32438e2557686673a3376a8 /src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java
parent60a9799c24f182b3c7e262754b6cc2e3400a4993 (diff)
downloadlombok-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/lombok/eclipse/handlers/HandleFieldNameConstants.java')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java8
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);
+ }
}
}