diff options
author | Roel Spilker <r.spilker@gmail.com> | 2018-06-04 23:36:06 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2018-06-04 23:36:45 +0200 |
commit | a74db7c10c61c7a18e8fed774cac1e0cde534009 (patch) | |
tree | 46106687a476be3a940efbfb27c98c8d5ef0912a | |
parent | b8e85f5dc7044e9a4bd43c41786bdda2a38f50ac (diff) | |
download | lombok-a74db7c10c61c7a18e8fed774cac1e0cde534009.tar.gz lombok-a74db7c10c61c7a18e8fed774cac1e0cde534009.tar.bz2 lombok-a74db7c10c61c7a18e8fed774cac1e0cde534009.zip |
Make `extraPrivate` opt-in instead of opt-out. Fixes #1708
23 files changed, 5 insertions, 130 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index f1575a53..f8b8a562 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -3,6 +3,7 @@ Lombok Changelog ### v1.16.23 "Edgy Guinea Pig" * v1.16.22 is the latest stable release of Project Lombok. +* BREAKING CHANGE: The in 1.16.22 introduced configuration key `lombok.noArgsConstructor.extraPrivate` is now `false` by default. [Issue #1708](https://github.com/rzwitserloot/lombok/issues/1708) * BUGFIX: Do not generate a private no-args constructor if that breaks the code. [Issue #1703](https://github.com/rzwitserloot/lombok/issues/1703), [Issue #1704](https://github.com/rzwitserloot/lombok/issues/1704), [Issue #1712](https://github.com/rzwitserloot/lombok/issues/1712) * BUGFIX: Using boolean parameters in lombok annotations would fail. [Issue #1709](https://github.com/rzwitserloot/lombok/issues/1709) * BUGFIX: Delombok would give an error message. [Issue #1705](https://github.com/rzwitserloot/lombok/issues/1705) diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index f9029319..eb7fd711 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -214,7 +214,7 @@ public class HandleConstructor { if (!isDirectDescendantOfObject(typeNode)) return; Boolean v = typeNode.getAst().readConfiguration(ConfigurationKeys.NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE); - if (v != null && !v) return; + if (v == null || !v) return; List<EclipseNode> fields = findFinalFields(typeNode); generate(typeNode, AccessLevel.PRIVATE, fields, true, null, SkipIfConstructorExists.NO, Collections.<Annotation>emptyList(), sourceNode, true); diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index f4aa6fbf..32eb43b2 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -200,7 +200,7 @@ public class HandleConstructor { if (!isDirectDescendantOfObject(typeNode)) return; Boolean v = typeNode.getAst().readConfiguration(ConfigurationKeys.NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE); - if (v != null && !v) return; + if (v == null || !v) return; List<JavacNode> fields = findFinalFields(typeNode); generate(typeNode, AccessLevel.PRIVATE, List.<JCAnnotation>nil(), fields, true, null, SkipIfConstructorExists.NO, source, true); diff --git a/test/transform/resource/after-delombok/BuilderDefaults.java b/test/transform/resource/after-delombok/BuilderDefaults.java index e92197ad..b916b725 100644 --- a/test/transform/resource/after-delombok/BuilderDefaults.java +++ b/test/transform/resource/after-delombok/BuilderDefaults.java @@ -67,12 +67,6 @@ public final class BuilderDefaults { return new BuilderDefaultsBuilder(); } @java.lang.SuppressWarnings("all") - private BuilderDefaults() { - this.x = 0; - this.name = null; - this.z = 0L; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java index 91674ea9..7fb300e4 100644 --- a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java @@ -44,11 +44,6 @@ public class BuilderWithRecursiveGenerics { return new TestBuilder<Foo, Bar, Quz>(); } @java.lang.SuppressWarnings("all") - private Test() { - this.foo = null; - this.bar = null; - } - @java.lang.SuppressWarnings("all") public Foo getFoo() { return this.foo; } diff --git a/test/transform/resource/after-delombok/DataIgnore.java b/test/transform/resource/after-delombok/DataIgnore.java index 02a0107f..309d8150 100644 --- a/test/transform/resource/after-delombok/DataIgnore.java +++ b/test/transform/resource/after-delombok/DataIgnore.java @@ -6,10 +6,6 @@ class DataIgnore { this.x = x; } @java.lang.SuppressWarnings("all") - private DataIgnore() { - this.x = 0; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java index c178f1f3..84817897 100644 --- a/test/transform/resource/after-delombok/DataOnLocalClass.java +++ b/test/transform/resource/after-delombok/DataOnLocalClass.java @@ -8,10 +8,6 @@ class DataOnLocalClass1 { this.x = x; } @java.lang.SuppressWarnings("all") - private Local() { - this.x = 0; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -72,9 +68,6 @@ class DataOnLocalClass2 { } this.name = name; } - @java.lang.SuppressWarnings("all") - private InnerLocal() { - } @lombok.NonNull @java.lang.SuppressWarnings("all") public String getName() { @@ -123,10 +116,6 @@ class DataOnLocalClass2 { this.x = x; } @java.lang.SuppressWarnings("all") - private Local() { - this.x = 0; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java index 7b3d8f11..d54baef1 100644 --- a/test/transform/resource/after-delombok/DataPlain.java +++ b/test/transform/resource/after-delombok/DataPlain.java @@ -6,10 +6,6 @@ class Data1 { this.x = x; } @java.lang.SuppressWarnings("all") - private Data1() { - this.x = 0; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -62,10 +58,6 @@ class Data2 { this.x = x; } @java.lang.SuppressWarnings("all") - private Data2() { - this.x = 0; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -118,10 +110,6 @@ final class Data3 { this.x = x; } @java.lang.SuppressWarnings("all") - private Data3() { - this.x = 0; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/DataWithGetter.java b/test/transform/resource/after-delombok/DataWithGetter.java index 6d3036f4..b4107bb3 100644 --- a/test/transform/resource/after-delombok/DataWithGetter.java +++ b/test/transform/resource/after-delombok/DataWithGetter.java @@ -7,10 +7,6 @@ class DataWithGetter { this.z = z; } @java.lang.SuppressWarnings("all") - private DataWithGetter() { - this.z = null; - } - @java.lang.SuppressWarnings("all") public void setX(final int x) { this.x = x; } diff --git a/test/transform/resource/after-delombok/DataWithGetterNone.java b/test/transform/resource/after-delombok/DataWithGetterNone.java index 692ee9a0..4467e407 100644 --- a/test/transform/resource/after-delombok/DataWithGetterNone.java +++ b/test/transform/resource/after-delombok/DataWithGetterNone.java @@ -7,10 +7,6 @@ class DataWithGetterNone { this.z = z; } @java.lang.SuppressWarnings("all") - private DataWithGetterNone() { - this.z = null; - } - @java.lang.SuppressWarnings("all") public void setX(final int x) { this.x = x; } diff --git a/test/transform/resource/after-delombok/InnerClass.java b/test/transform/resource/after-delombok/InnerClass.java index 8040d9ff..2e49b9ad 100644 --- a/test/transform/resource/after-delombok/InnerClass.java +++ b/test/transform/resource/after-delombok/InnerClass.java @@ -20,10 +20,6 @@ class C { this.a = a; } @java.lang.SuppressWarnings("all") - private D() { - this.a = null; - } - @java.lang.SuppressWarnings("all") public A getA() { return this.a; } diff --git a/test/transform/resource/after-delombok/ValuePlain.java b/test/transform/resource/after-delombok/ValuePlain.java index 0cbd8621..cf2c1142 100644 --- a/test/transform/resource/after-delombok/ValuePlain.java +++ b/test/transform/resource/after-delombok/ValuePlain.java @@ -7,11 +7,6 @@ final class Value1 { this.name = name; } @java.lang.SuppressWarnings("all") - private Value1() { - this.x = 0; - this.name = null; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -56,11 +51,6 @@ class Value2 { this.name = name; } @java.lang.SuppressWarnings("all") - private Value2() { - this.x = 0; - this.name = null; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -110,10 +100,6 @@ final class Value3 { this.y = y; } @java.lang.SuppressWarnings("all") - private Value3() { - this.y = 0; - } - @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-ecj/BuilderDefaults.java b/test/transform/resource/after-ecj/BuilderDefaults.java index 1b9cd0ac..1a0f1168 100644 --- a/test/transform/resource/after-ecj/BuilderDefaults.java +++ b/test/transform/resource/after-ecj/BuilderDefaults.java @@ -87,10 +87,4 @@ public final @Value @Builder class BuilderDefaults { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("BuilderDefaults(x=" + this.getX()) + ", name=") + this.getName()) + ", z=") + this.getZ()) + ")"); } - private @java.lang.SuppressWarnings("all") BuilderDefaults() { - super(); - this.x = 0; - this.name = null; - this.z = 0L; - } } diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java index 1db5a914..8246ca2c 100644 --- a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java @@ -70,11 +70,6 @@ public class BuilderWithRecursiveGenerics { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); } - private @java.lang.SuppressWarnings("all") Test() { - super(); - this.foo = null; - this.bar = null; - } } public BuilderWithRecursiveGenerics() { super(); diff --git a/test/transform/resource/after-ecj/DataIgnore.java b/test/transform/resource/after-ecj/DataIgnore.java index d0fd1b1b..d3ac8aa3 100644 --- a/test/transform/resource/after-ecj/DataIgnore.java +++ b/test/transform/resource/after-ecj/DataIgnore.java @@ -32,8 +32,4 @@ super(); this.x = x; } - private @java.lang.SuppressWarnings("all") DataIgnore() { - super(); - this.x = 0; - } } diff --git a/test/transform/resource/after-ecj/DataOnLocalClass.java b/test/transform/resource/after-ecj/DataOnLocalClass.java index 03f0caaf..341df49b 100644 --- a/test/transform/resource/after-ecj/DataOnLocalClass.java +++ b/test/transform/resource/after-ecj/DataOnLocalClass.java @@ -50,10 +50,6 @@ class DataOnLocalClass1 { super(); this.x = x; } - private @java.lang.SuppressWarnings("all") Local() { - super(); - this.x = 0; - } } } } @@ -107,9 +103,6 @@ class DataOnLocalClass2 { } this.name = name; } - private @java.lang.SuppressWarnings("all") InnerLocal() { - super(); - } } final int x; public @java.lang.SuppressWarnings("all") int getX() { @@ -143,10 +136,6 @@ class DataOnLocalClass2 { super(); this.x = x; } - private @java.lang.SuppressWarnings("all") Local() { - super(); - this.x = 0; - } } } DataOnLocalClass2() { diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java index be46cd24..eaeef509 100644 --- a/test/transform/resource/after-ecj/DataPlain.java +++ b/test/transform/resource/after-ecj/DataPlain.java @@ -45,10 +45,6 @@ import lombok.Data; super(); this.x = x; } - private @java.lang.SuppressWarnings("all") Data1() { - super(); - this.x = 0; - } } @Data class Data2 { final int x; @@ -96,10 +92,6 @@ import lombok.Data; super(); this.x = x; } - private @java.lang.SuppressWarnings("all") Data2() { - super(); - this.x = 0; - } } final @Data class Data3 { final int x; @@ -142,10 +134,6 @@ final @Data class Data3 { super(); this.x = x; } - private @java.lang.SuppressWarnings("all") Data3() { - super(); - this.x = 0; - } } final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java.util.Timer { int x; diff --git a/test/transform/resource/after-ecj/DataWithGetter.java b/test/transform/resource/after-ecj/DataWithGetter.java index 0fec7684..fa291eca 100644 --- a/test/transform/resource/after-ecj/DataWithGetter.java +++ b/test/transform/resource/after-ecj/DataWithGetter.java @@ -45,10 +45,6 @@ super(); this.z = z; } - private @java.lang.SuppressWarnings("all") DataWithGetter() { - super(); - this.z = null; - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } diff --git a/test/transform/resource/after-ecj/DataWithGetterNone.java b/test/transform/resource/after-ecj/DataWithGetterNone.java index fb4a7c2e..4545dc46 100644 --- a/test/transform/resource/after-ecj/DataWithGetterNone.java +++ b/test/transform/resource/after-ecj/DataWithGetterNone.java @@ -45,8 +45,4 @@ super(); this.z = z; } - private @java.lang.SuppressWarnings("all") DataWithGetterNone() { - super(); - this.z = null; - } } diff --git a/test/transform/resource/after-ecj/InnerClass.java b/test/transform/resource/after-ecj/InnerClass.java index 05c6dc94..32004225 100644 --- a/test/transform/resource/after-ecj/InnerClass.java +++ b/test/transform/resource/after-ecj/InnerClass.java @@ -49,10 +49,6 @@ class C { super(); this.a = a; } - private @java.lang.SuppressWarnings("all") D() { - super(); - this.a = null; - } } C() { super(); diff --git a/test/transform/resource/after-ecj/ValuePlain.java b/test/transform/resource/after-ecj/ValuePlain.java index 0ff7369e..442a63ac 100644 --- a/test/transform/resource/after-ecj/ValuePlain.java +++ b/test/transform/resource/after-ecj/ValuePlain.java @@ -38,11 +38,6 @@ final @lombok.Value class Value1 { this.x = x; this.name = name; } - private @java.lang.SuppressWarnings("all") Value1() { - super(); - this.x = 0; - this.name = null; - } } @Value @lombok.experimental.NonFinal class Value2 { public final int x; @@ -88,11 +83,6 @@ final @lombok.Value class Value1 { this.x = x; this.name = name; } - private @java.lang.SuppressWarnings("all") Value2() { - super(); - this.x = 0; - this.name = null; - } } final @Value class Value3 { private @lombok.experimental.NonFinal int x; @@ -130,8 +120,4 @@ final @Value class Value3 { this.x = x; this.y = y; } - private @java.lang.SuppressWarnings("all") Value3() { - super(); - this.y = 0; - } } diff --git a/test/transform/resource/before/DataConfiguration.java b/test/transform/resource/before/DataConfiguration.java index 8b9657f9..9e0bd420 100644 --- a/test/transform/resource/before/DataConfiguration.java +++ b/test/transform/resource/before/DataConfiguration.java @@ -1,6 +1,7 @@ //CONF: lombok.anyConstructor.suppressConstructorProperties = true //CONF: lombok.toString.doNotUseGetters = true //CONF: lombok.equalsAndHashCode.doNotUseGetters = true +//CONF: lombok.noArgsConstructor.extraPrivate = true @lombok.Data class DataConfiguration { final int x; diff --git a/test/transform/resource/before/PrivateNoArgsConstructor.java b/test/transform/resource/before/PrivateNoArgsConstructor.java index 911e430f..38f5aed0 100644 --- a/test/transform/resource/before/PrivateNoArgsConstructor.java +++ b/test/transform/resource/before/PrivateNoArgsConstructor.java @@ -1,3 +1,4 @@ +// CONF: lombok.noArgsConstructor.extraPrivate = true // CONF: lombok.equalsAndHashCode.callSuper = call public class PrivateNoArgsConstructor { private static class Base { |