aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2021-10-22 10:35:39 +0200
committerGitHub <noreply@github.com>2021-10-22 10:35:39 +0200
commit82592b84bf803bc9802768afaa802b0dc58d6c83 (patch)
treec978347378b6c9cd6a31770ac3780193ad13896b /src
parent8bbac04478cb088eedceb4c63dcb45e30f0948ed (diff)
parent1d7db8c4dfa2f7a26d9816398947f6e76e506093 (diff)
downloadlombok-82592b84bf803bc9802768afaa802b0dc58d6c83.tar.gz
lombok-82592b84bf803bc9802768afaa802b0dc58d6c83.tar.bz2
lombok-82592b84bf803bc9802768afaa802b0dc58d6c83.zip
Merge pull request #3009 from Rawi01/field-defaults-record
Skip records for field defaults via config
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleFieldDefaults.java2
-rw-r--r--src/core/lombok/javac/handlers/HandleFieldDefaults.java2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java
index 5900e7ed..3297ba06 100644
--- a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java
+++ b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java
@@ -160,6 +160,8 @@ public class HandleFieldDefaults extends EclipseASTAdapter {
boolean defaultToFinal = makeFinalIsExplicit ? false : Boolean.TRUE.equals(typeNode.getAst().readConfiguration(ConfigurationKeys.FIELD_DEFAULTS_FINAL_EVERYWHERE));
if (!defaultToPrivate && !defaultToFinal && fieldDefaults == null) return;
+ // Do not apply field defaults to records if set using the the config system
+ if (fieldDefaults == null && !isClassOrEnum(typeNode)) return;
AccessLevel fdAccessLevel = (fieldDefaults != null && levelIsExplicit) ? fd.level() : defaultToPrivate ? AccessLevel.PRIVATE : null;
boolean fdToFinal = (fieldDefaults != null && makeFinalIsExplicit) ? fd.makeFinal() : defaultToFinal;
diff --git a/src/core/lombok/javac/handlers/HandleFieldDefaults.java b/src/core/lombok/javac/handlers/HandleFieldDefaults.java
index ebab67e3..9a6632dd 100644
--- a/src/core/lombok/javac/handlers/HandleFieldDefaults.java
+++ b/src/core/lombok/javac/handlers/HandleFieldDefaults.java
@@ -140,6 +140,8 @@ public class HandleFieldDefaults extends JavacASTAdapter {
boolean defaultToFinal = makeFinalIsExplicit ? false : Boolean.TRUE.equals(typeNode.getAst().readConfiguration(ConfigurationKeys.FIELD_DEFAULTS_FINAL_EVERYWHERE));
if (!defaultToPrivate && !defaultToFinal && fieldDefaults == null) return;
+ // Do not apply field defaults to records if set using the the config system
+ if (fieldDefaults == null && !isClassOrEnum(typeNode)) return;
AccessLevel fdAccessLevel = (fieldDefaults != null && levelIsExplicit) ? fd.level() : defaultToPrivate ? AccessLevel.PRIVATE : null;
boolean fdToFinal = (fieldDefaults != null && makeFinalIsExplicit) ? fd.makeFinal() : defaultToFinal;