diff options
42 files changed, 48 insertions, 38 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index c5e4a652..26646b46 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -7,6 +7,7 @@ Lombok Changelog * PLATFORM: JDK9 now supported for compilation (delomboking with java9 not yet possible). Note, you'll have to do some command line wrangling. See [Issue #985](https://github.com/rzwitserloot/lombok/issues/985) * BUGFIX: The `onX` feature (which lets you add annotations to generated methods) did not work if the annotation you added contained named parameters, and you are compiling with JDK8's javac. We can't fix this (it's a bug in javac), but we have provided an alternate, prettier way to do `onX` on javac8+. [Issue #778](https://github.com/rzwitserloot/lombok/issues/778) [onX documentation](https://projectlombok.org/features/experimental/onX.html) * BUGFIX: `@Data` and `@Value` now respect the configuration for field access when generating equals, hashCode and toString [Issue #1329](https://github.com/rzwitserloot/lombok/issues/1329) +* CHANGE: `@ConstructorProperties` will now also be generated for private and package private constructors. This is useful for Jackson [Issue #1180](https://github.com/rzwitserloot/lombok/issues/1180) ### v1.16.14 (February 10th, 2017) * FEATURE: Generated classes, methods and fields can now also annotated with `@lombok.Generated` [Issue #1014](https://github.com/rzwitserloot/lombok/issues/1014) diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index 5978d542..856f3611 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -364,7 +364,7 @@ public class HandleConstructor { /* Generate annotations that must be put on the generated method, and attach them. */ { Annotation[] constructorProperties = null; - if (!allToDefault && !suppressConstructorProperties && level != AccessLevel.PRIVATE && level != AccessLevel.PACKAGE && !isLocalType(type)) { + if (!allToDefault && !suppressConstructorProperties && !isLocalType(type)) { constructorProperties = createConstructorProperties(source, fields); } diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index be4af41c..56036963 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -299,7 +299,7 @@ public class HandleConstructor { } JCModifiers mods = maker.Modifiers(toJavacModifier(level), List.<JCAnnotation>nil()); - if (!allToDefault && !suppressConstructorProperties && level != AccessLevel.PRIVATE && level != AccessLevel.PACKAGE && !isLocalType(typeNode) && LombokOptionsFactory.getDelombokOptions(typeNode.getContext()).getFormatPreferences().generateConstructorProperties()) { + if (!allToDefault && !suppressConstructorProperties && !isLocalType(typeNode) && LombokOptionsFactory.getDelombokOptions(typeNode.getContext()).getFormatPreferences().generateConstructorProperties()) { addConstructorProperties(mods, typeNode, fields); } if (onConstructor != null) mods.annotations = mods.annotations.appendList(copyAnnotations(onConstructor)); diff --git a/test/transform/resource/after-delombok/BuilderChainAndFluent.java b/test/transform/resource/after-delombok/BuilderChainAndFluent.java index 2475a998..9a93ab7d 100644 --- a/test/transform/resource/after-delombok/BuilderChainAndFluent.java +++ b/test/transform/resource/after-delombok/BuilderChainAndFluent.java @@ -1,5 +1,6 @@ class BuilderChainAndFluent { private final int yes; + @java.beans.ConstructorProperties({"yes"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderChainAndFluent(final int yes) { diff --git a/test/transform/resource/after-delombok/BuilderDefaults.java b/test/transform/resource/after-delombok/BuilderDefaults.java index c5c8006a..475b7558 100644 --- a/test/transform/resource/after-delombok/BuilderDefaults.java +++ b/test/transform/resource/after-delombok/BuilderDefaults.java @@ -12,6 +12,7 @@ public final class BuilderDefaults { private static long $default$z() { return System.currentTimeMillis(); } + @java.beans.ConstructorProperties({"x", "name", "z"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderDefaults(final int x, final String name, final long z) { diff --git a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java index ccc39a9e..97c94137 100644 --- a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java +++ b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java @@ -3,6 +3,7 @@ public class BuilderDefaultsWarnings { final int y = 5; int z; java.util.List<String> items; + @java.beans.ConstructorProperties({"x", "z", "items"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderDefaultsWarnings(final long x, final int z, final java.util.List<String> items) { diff --git a/test/transform/resource/after-delombok/BuilderSimple.java b/test/transform/resource/after-delombok/BuilderSimple.java index a12ad047..138127b6 100644 --- a/test/transform/resource/after-delombok/BuilderSimple.java +++ b/test/transform/resource/after-delombok/BuilderSimple.java @@ -4,6 +4,7 @@ class BuilderSimple<T> { private final int yes; private List<T> also; private int $butNotMe; + @java.beans.ConstructorProperties({"yes", "also"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSimple(final int yes, final List<T> also) { diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSets.java b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSets.java index 08becf6b..a6c475f3 100644 --- a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSets.java +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSets.java @@ -10,6 +10,7 @@ class BuilderSingularGuavaListsSets<T> { private ImmutableSet rawSet; private ImmutableSortedSet<String> passes; private ImmutableTable<? extends Number, ? extends Number, String> users; + @java.beans.ConstructorProperties({"cards", "frogs", "rawSet", "passes", "users"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) { diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaMaps.java b/test/transform/resource/after-delombok/BuilderSingularGuavaMaps.java index d6c38790..7d7f996e 100644 --- a/test/transform/resource/after-delombok/BuilderSingularGuavaMaps.java +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaMaps.java @@ -6,6 +6,7 @@ class BuilderSingularGuavaMaps<K, V> { private ImmutableSortedMap<Integer, ? extends V> vertices; @SuppressWarnings("all") private ImmutableBiMap rawMap; + @java.beans.ConstructorProperties({"battleaxes", "vertices", "rawMap"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularGuavaMaps(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) { diff --git a/test/transform/resource/after-delombok/BuilderSingularLists.java b/test/transform/resource/after-delombok/BuilderSingularLists.java index 9b409404..6df4d2b9 100644 --- a/test/transform/resource/after-delombok/BuilderSingularLists.java +++ b/test/transform/resource/after-delombok/BuilderSingularLists.java @@ -5,6 +5,7 @@ class BuilderSingularLists<T> { private Collection<? extends Number> scarves; @SuppressWarnings("all") private List rawList; + @java.beans.ConstructorProperties({"children", "scarves", "rawList"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularLists(final List<T> children, final Collection<? extends Number> scarves, final List rawList) { diff --git a/test/transform/resource/after-delombok/BuilderSingularMaps.java b/test/transform/resource/after-delombok/BuilderSingularMaps.java index 6520568b..90e97d8f 100644 --- a/test/transform/resource/after-delombok/BuilderSingularMaps.java +++ b/test/transform/resource/after-delombok/BuilderSingularMaps.java @@ -6,6 +6,7 @@ class BuilderSingularMaps<K, V> { @SuppressWarnings("all") private Map rawMap; private Map<String, V> stringMap; + @java.beans.ConstructorProperties({"women", "men", "rawMap", "stringMap"}) @SuppressWarnings("all") BuilderSingularMaps(Map<K, V> women, SortedMap<K, ? extends Number> men, Map rawMap, Map<String, V> stringMap) { this.women = women; diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java index 71ec0c7a..973f024a 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java @@ -3,6 +3,7 @@ class BuilderSingularNoAuto { private List<String> things; private List<String> widgets; private List<String> items; + @java.beans.ConstructorProperties({"things", "widgets", "items"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularNoAuto(final List<String> things, final List<String> widgets, final List<String> items) { diff --git a/test/transform/resource/after-delombok/BuilderSingularRedirectToGuava.java b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuava.java index ff194b47..d0ad06f6 100644 --- a/test/transform/resource/after-delombok/BuilderSingularRedirectToGuava.java +++ b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuava.java @@ -5,6 +5,7 @@ class BuilderSingularRedirectToGuava { private Set<String> dangerMice; private NavigableMap<Integer, Number> things; private Collection<Class<?>> doohickeys; + @java.beans.ConstructorProperties({"dangerMice", "things", "doohickeys"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularRedirectToGuava(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) { diff --git a/test/transform/resource/after-delombok/BuilderSingularSets.java b/test/transform/resource/after-delombok/BuilderSingularSets.java index 2461d2fd..8afdf5d0 100644 --- a/test/transform/resource/after-delombok/BuilderSingularSets.java +++ b/test/transform/resource/after-delombok/BuilderSingularSets.java @@ -6,6 +6,7 @@ class BuilderSingularSets<T> { @SuppressWarnings("all") private Set rawSet; private Set<String> stringSet; + @java.beans.ConstructorProperties({"dangerMice", "octopodes", "rawSet", "stringSet"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularSets(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) { diff --git a/test/transform/resource/after-delombok/BuilderSingularWithPrefixes.java b/test/transform/resource/after-delombok/BuilderSingularWithPrefixes.java index a6bd2f88..4eee4fc2 100644 --- a/test/transform/resource/after-delombok/BuilderSingularWithPrefixes.java +++ b/test/transform/resource/after-delombok/BuilderSingularWithPrefixes.java @@ -1,5 +1,6 @@ class BuilderSingularWithPrefixes { private java.util.List<String> _elems; + @java.beans.ConstructorProperties({"elems"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularWithPrefixes(final java.util.List<String> elems) { diff --git a/test/transform/resource/after-delombok/BuilderWithAccessors.java b/test/transform/resource/after-delombok/BuilderWithAccessors.java index db3cc3d8..1f9a1f22 100644 --- a/test/transform/resource/after-delombok/BuilderWithAccessors.java +++ b/test/transform/resource/after-delombok/BuilderWithAccessors.java @@ -3,6 +3,7 @@ class BuilderWithAccessors { private final int pUpper; private int _foo; private int __bar; + @java.beans.ConstructorProperties({"plower", "upper", "foo", "_bar"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java index edc1e3c6..0f0efe00 100644 --- a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java @@ -5,6 +5,7 @@ public class BuilderWithRecursiveGenerics { public static final class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { private final Foo foo; private final Bar bar; + @java.beans.ConstructorProperties({"foo", "bar"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Test(final Foo foo, final Bar bar) { diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilder.java b/test/transform/resource/after-delombok/BuilderWithToBuilder.java index 7dfb046a..e1c7a92d 100644 --- a/test/transform/resource/after-delombok/BuilderWithToBuilder.java +++ b/test/transform/resource/after-delombok/BuilderWithToBuilder.java @@ -7,6 +7,7 @@ class BuilderWithToBuilder<T> { public static <K> K rrr(BuilderWithToBuilder<K> x) { return x.foo; } + @java.beans.ConstructorProperties({"one", "two", "foo", "bars"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilder(final String one, final String two, final T foo, final List<T> bars) { diff --git a/test/transform/resource/after-delombok/BuilderWithTolerate.java b/test/transform/resource/after-delombok/BuilderWithTolerate.java index 5eff9120..1992fd4b 100644 --- a/test/transform/resource/after-delombok/BuilderWithTolerate.java +++ b/test/transform/resource/after-delombok/BuilderWithTolerate.java @@ -1,42 +1,32 @@ - import lombok.experimental.Tolerate; - public class BuilderWithTolerate { private final int value; - public static void main(String[] args) { BuilderWithTolerate.builder().value("42").build(); } - - public static class BuilderWithTolerateBuilder { @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") private int value; - @Tolerate public BuilderWithTolerateBuilder value(String s) { return this.value(Integer.parseInt(s)); } - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerateBuilder() { } - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public BuilderWithTolerateBuilder value(final int value) { this.value = value; return this; } - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public BuilderWithTolerate build() { return new BuilderWithTolerate(value); } - @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") @@ -44,13 +34,12 @@ public class BuilderWithTolerate { return "BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value + ")"; } } - + @java.beans.ConstructorProperties({"value"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerate(final int value) { this.value = value; } - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public static BuilderWithTolerateBuilder builder() { diff --git a/test/transform/resource/after-delombok/Constructors.java b/test/transform/resource/after-delombok/Constructors.java index c138a00c..b8eaa678 100644 --- a/test/transform/resource/after-delombok/Constructors.java +++ b/test/transform/resource/after-delombok/Constructors.java @@ -21,6 +21,7 @@ class RequiredArgsConstructorAccess { class RequiredArgsConstructorStaticName { final int x; String name; + @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") private RequiredArgsConstructorStaticName(final int x) { @@ -65,6 +66,7 @@ class NoArgsConstructor1 { class RequiredArgsConstructorStaticNameGenerics<T extends Number> { final T x; String name; + @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") private RequiredArgsConstructorStaticNameGenerics(final T x) { @@ -79,6 +81,7 @@ class RequiredArgsConstructorStaticNameGenerics<T extends Number> { class RequiredArgsConstructorStaticNameGenerics2<T extends Number> { final Class<T> x; String name; + @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") private RequiredArgsConstructorStaticNameGenerics2(final Class<T> x) { @@ -92,6 +95,7 @@ class RequiredArgsConstructorStaticNameGenerics2<T extends Number> { } class AllArgsConstructorPackageAccess { final String x; + @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") AllArgsConstructorPackageAccess(final String x) { diff --git a/test/transform/resource/after-delombok/DataOnEnum.java b/test/transform/resource/after-delombok/DataOnEnum.java index 5316c022..bb973717 100644 --- a/test/transform/resource/after-delombok/DataOnEnum.java +++ b/test/transform/resource/after-delombok/DataOnEnum.java @@ -12,6 +12,7 @@ public enum DataOnEnum { public java.lang.String toString() { return "DataOnEnum(someField=" + this.getSomeField() + ")"; } + @java.beans.ConstructorProperties({"someField"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") private DataOnEnum(final String someField) { diff --git a/test/transform/resource/after-delombok/GetterEnum.java b/test/transform/resource/after-delombok/GetterEnum.java index 25b5fd8b..439430ee 100644 --- a/test/transform/resource/after-delombok/GetterEnum.java +++ b/test/transform/resource/after-delombok/GetterEnum.java @@ -2,6 +2,7 @@ enum GetterEnum { ONE(1, "One"); private final int id; private final String name; + @java.beans.ConstructorProperties({"id", "name"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") private GetterEnum(final int id, final String name) { diff --git a/test/transform/resource/after-ecj/BuilderChainAndFluent.java b/test/transform/resource/after-ecj/BuilderChainAndFluent.java index 1554cf44..6a59dba9 100644 --- a/test/transform/resource/after-ecj/BuilderChainAndFluent.java +++ b/test/transform/resource/after-ecj/BuilderChainAndFluent.java @@ -15,7 +15,7 @@ } } private final int yes; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderChainAndFluent(final int yes) { + @java.beans.ConstructorProperties({"yes"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderChainAndFluent(final int yes) { super(); this.yes = yes; } diff --git a/test/transform/resource/after-ecj/BuilderDefaults.java b/test/transform/resource/after-ecj/BuilderDefaults.java index 96903dca..697a2e35 100644 --- a/test/transform/resource/after-ecj/BuilderDefaults.java +++ b/test/transform/resource/after-ecj/BuilderDefaults.java @@ -40,7 +40,7 @@ public final @Value @Builder class BuilderDefaults { private static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") long $default$z() { return System.currentTimeMillis(); } - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderDefaults(final int x, final String name, final long z) { + @java.beans.ConstructorProperties({"x", "name", "z"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderDefaults(final int x, final String name, final long z) { super(); this.x = x; this.name = name; diff --git a/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java b/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java index 275d6166..29ac5307 100644 --- a/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java +++ b/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java @@ -55,7 +55,7 @@ public @Builder class BuilderDefaultsWarnings { final int y = 5; @Builder.Default int z; @Builder.Default @Singular java.util.List<String> items; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderDefaultsWarnings(final long x, final int z, final java.util.List<String> items) { + @java.beans.ConstructorProperties({"x", "z", "items"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderDefaultsWarnings(final long x, final int z, final java.util.List<String> items) { super(); this.x = x; this.z = z; diff --git a/test/transform/resource/after-ecj/BuilderSimple.java b/test/transform/resource/after-ecj/BuilderSimple.java index 53d1ed9e..ecac411b 100644 --- a/test/transform/resource/after-ecj/BuilderSimple.java +++ b/test/transform/resource/after-ecj/BuilderSimple.java @@ -25,7 +25,7 @@ import java.util.List; private final int yes; private List<T> also; private int $butNotMe; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSimple(final int yes, final List<T> also) { + @java.beans.ConstructorProperties({"yes", "also"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSimple(final int yes, final List<T> also) { super(); this.yes = yes; this.also = also; diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java index 5cf9f4ac..59e5edd3 100644 --- a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java @@ -111,7 +111,7 @@ import lombok.Singular; private @SuppressWarnings("all") @Singular("rawSet") ImmutableSet rawSet; private @Singular ImmutableSortedSet<String> passes; private @Singular ImmutableTable<? extends Number, ? extends Number, String> users; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) { + @java.beans.ConstructorProperties({"cards", "frogs", "rawSet", "passes", "users"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) { super(); this.cards = cards; this.frogs = frogs; diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java b/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java index 378ec309..18193647 100644 --- a/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java @@ -71,7 +71,7 @@ import lombok.Singular; private @Singular ImmutableMap<K, V> battleaxes; private @Singular ImmutableSortedMap<Integer, ? extends V> vertices; private @SuppressWarnings("all") @Singular("rawMap") ImmutableBiMap rawMap; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularGuavaMaps(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) { + @java.beans.ConstructorProperties({"battleaxes", "vertices", "rawMap"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularGuavaMaps(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) { super(); this.battleaxes = battleaxes; this.vertices = vertices; diff --git a/test/transform/resource/after-ecj/BuilderSingularLists.java b/test/transform/resource/after-ecj/BuilderSingularLists.java index e1036262..3ea89f67 100644 --- a/test/transform/resource/after-ecj/BuilderSingularLists.java +++ b/test/transform/resource/after-ecj/BuilderSingularLists.java @@ -104,7 +104,7 @@ import lombok.Singular; private @Singular List<T> children; private @Singular Collection<? extends Number> scarves; private @SuppressWarnings("all") @Singular("rawList") List rawList; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularLists(final List<T> children, final Collection<? extends Number> scarves, final List rawList) { + @java.beans.ConstructorProperties({"children", "scarves", "rawList"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularLists(final List<T> children, final Collection<? extends Number> scarves, final List rawList) { super(); this.children = children; this.scarves = scarves; diff --git a/test/transform/resource/after-ecj/BuilderSingularMaps.java b/test/transform/resource/after-ecj/BuilderSingularMaps.java index 38ac0ed7..1a4a5b42 100644 --- a/test/transform/resource/after-ecj/BuilderSingularMaps.java +++ b/test/transform/resource/after-ecj/BuilderSingularMaps.java @@ -196,7 +196,7 @@ import lombok.Singular; private @Singular SortedMap<K, ? extends Number> men; private @SuppressWarnings("all") @Singular("rawMap") Map rawMap; private @Singular("stringMap") Map<String, V> stringMap; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularMaps(final Map<K, V> women, final SortedMap<K, ? extends Number> men, final Map rawMap, final Map<String, V> stringMap) { + @java.beans.ConstructorProperties({"women", "men", "rawMap", "stringMap"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularMaps(final Map<K, V> women, final SortedMap<K, ? extends Number> men, final Map rawMap, final Map<String, V> stringMap) { super(); this.women = women; this.men = men; diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAuto.java b/test/transform/resource/after-ecj/BuilderSingularNoAuto.java index 1b79538c..a5204afa 100644 --- a/test/transform/resource/after-ecj/BuilderSingularNoAuto.java +++ b/test/transform/resource/after-ecj/BuilderSingularNoAuto.java @@ -102,7 +102,7 @@ import lombok.Singular; private @Singular List<String> things; private @Singular("widget") List<String> widgets; private @Singular List<String> items; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularNoAuto(final List<String> things, final List<String> widgets, final List<String> items) { + @java.beans.ConstructorProperties({"things", "widgets", "items"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularNoAuto(final List<String> things, final List<String> widgets, final List<String> items) { super(); this.things = things; this.widgets = widgets; diff --git a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java index 84335f46..4a540dd0 100644 --- a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java +++ b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java @@ -71,7 +71,7 @@ import lombok.Singular; private @Singular Set<String> dangerMice; private @Singular NavigableMap<Integer, Number> things; private @Singular Collection<Class<?>> doohickeys; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularRedirectToGuava(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) { + @java.beans.ConstructorProperties({"dangerMice", "things", "doohickeys"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularRedirectToGuava(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) { super(); this.dangerMice = dangerMice; this.things = things; diff --git a/test/transform/resource/after-ecj/BuilderSingularSets.java b/test/transform/resource/after-ecj/BuilderSingularSets.java index 118eb16f..b20b135a 100644 --- a/test/transform/resource/after-ecj/BuilderSingularSets.java +++ b/test/transform/resource/after-ecj/BuilderSingularSets.java @@ -132,7 +132,7 @@ import lombok.Singular; private @Singular SortedSet<? extends Number> octopodes; private @SuppressWarnings("all") @Singular("rawSet") Set rawSet; private @Singular("stringSet") Set<String> stringSet; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularSets(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) { + @java.beans.ConstructorProperties({"dangerMice", "octopodes", "rawSet", "stringSet"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularSets(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) { super(); this.dangerMice = dangerMice; this.octopodes = octopodes; diff --git a/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java index c0e4af75..797b62b9 100644 --- a/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java +++ b/test/transform/resource/after-ecj/BuilderSingularWithPrefixes.java @@ -41,7 +41,7 @@ import lombok.Singular; } } private @Singular java.util.List<String> _elems; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularWithPrefixes(final java.util.List<String> elems) { + @java.beans.ConstructorProperties({"elems"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderSingularWithPrefixes(final java.util.List<String> elems) { super(); this._elems = elems; } diff --git a/test/transform/resource/after-ecj/BuilderWithAccessors.java b/test/transform/resource/after-ecj/BuilderWithAccessors.java index de93a75c..d57769c4 100644 --- a/test/transform/resource/after-ecj/BuilderWithAccessors.java +++ b/test/transform/resource/after-ecj/BuilderWithAccessors.java @@ -34,7 +34,7 @@ private final int pUpper; private int _foo; private int __bar; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { + @java.beans.ConstructorProperties({"plower", "upper", "foo", "_bar"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { super(); this.plower = plower; this.pUpper = upper; diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java index f13b8b9b..92a3b641 100644 --- a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java @@ -28,7 +28,7 @@ public class BuilderWithRecursiveGenerics { } private final Foo foo; private final Bar bar; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Test(final Foo foo, final Bar bar) { + @java.beans.ConstructorProperties({"foo", "bar"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Test(final Foo foo, final Bar bar) { super(); this.foo = foo; this.bar = bar; diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilder.java b/test/transform/resource/after-ecj/BuilderWithToBuilder.java index 0d296cb6..2c08e510 100644 --- a/test/transform/resource/after-ecj/BuilderWithToBuilder.java +++ b/test/transform/resource/after-ecj/BuilderWithToBuilder.java @@ -63,7 +63,7 @@ import lombok.Builder; public static <K>K rrr(BuilderWithToBuilder<K> x) { return x.foo; } - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilder(final String one, final String two, final T foo, final List<T> bars) { + @java.beans.ConstructorProperties({"one", "two", "foo", "bars"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilder(final String one, final String two, final T foo, final List<T> bars) { super(); this.mOne = one; this.mTwo = two; diff --git a/test/transform/resource/after-ecj/BuilderWithTolerate.java b/test/transform/resource/after-ecj/BuilderWithTolerate.java index 0b9b46a0..dd6e28eb 100644 --- a/test/transform/resource/after-ecj/BuilderWithTolerate.java +++ b/test/transform/resource/after-ecj/BuilderWithTolerate.java @@ -24,7 +24,7 @@ public @Builder class BuilderWithTolerate { public static void main(String[] args) { BuilderWithTolerate.builder().value("42").build(); } - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerate(final int value) { + @java.beans.ConstructorProperties({"value"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerate(final int value) { super(); this.value = value; } diff --git a/test/transform/resource/after-ecj/Constructors.java b/test/transform/resource/after-ecj/Constructors.java index 4cc24a81..42c07fd0 100644 --- a/test/transform/resource/after-ecj/Constructors.java +++ b/test/transform/resource/after-ecj/Constructors.java @@ -17,7 +17,7 @@ @lombok.RequiredArgsConstructor(staticName = "staticname") class RequiredArgsConstructorStaticName { final int x; String name; - private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") RequiredArgsConstructorStaticName(final int x) { + private @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") RequiredArgsConstructorStaticName(final int x) { super(); this.x = x; } @@ -52,7 +52,7 @@ @lombok.RequiredArgsConstructor(staticName = "of") class RequiredArgsConstructorStaticNameGenerics<T extends Number> { final T x; String name; - private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") RequiredArgsConstructorStaticNameGenerics(final T x) { + private @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") RequiredArgsConstructorStaticNameGenerics(final T x) { super(); this.x = x; } @@ -63,7 +63,7 @@ @lombok.RequiredArgsConstructor(staticName = "of") class RequiredArgsConstructorStaticNameGenerics2<T extends Number> { final Class<T> x; String name; - private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") RequiredArgsConstructorStaticNameGenerics2(final Class<T> x) { + private @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") RequiredArgsConstructorStaticNameGenerics2(final Class<T> x) { super(); this.x = x; } @@ -73,7 +73,7 @@ } @lombok.AllArgsConstructor(access = lombok.AccessLevel.PACKAGE) class AllArgsConstructorPackageAccess { final String x; - @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") AllArgsConstructorPackageAccess(final String x) { + @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") AllArgsConstructorPackageAccess(final String x) { super(); this.x = x; } diff --git a/test/transform/resource/after-ecj/DataOnEnum.java b/test/transform/resource/after-ecj/DataOnEnum.java index 917a840b..5ded0767 100644 --- a/test/transform/resource/after-ecj/DataOnEnum.java +++ b/test/transform/resource/after-ecj/DataOnEnum.java @@ -9,7 +9,7 @@ public @lombok.Getter @lombok.ToString @lombok.RequiredArgsConstructor enum Data public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { return (("DataOnEnum(someField=" + this.getSomeField()) + ")"); } - private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") DataOnEnum(final String someField) { + private @java.beans.ConstructorProperties({"someField"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") DataOnEnum(final String someField) { super(); this.someField = someField; } diff --git a/test/transform/resource/after-ecj/GetterEnum.java b/test/transform/resource/after-ecj/GetterEnum.java index 22a5b0fd..2299e69d 100644 --- a/test/transform/resource/after-ecj/GetterEnum.java +++ b/test/transform/resource/after-ecj/GetterEnum.java @@ -13,7 +13,7 @@ import lombok.RequiredArgsConstructor; public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") String getName() { return this.name; } - private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") GetterEnum(final int id, final String name) { + private @java.beans.ConstructorProperties({"id", "name"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") GetterEnum(final int id, final String name) { super(); this.id = id; this.name = name; diff --git a/website/features/Constructor.html b/website/features/Constructor.html index 88a8f6ac..407f54ad 100644 --- a/website/features/Constructor.html +++ b/website/features/Constructor.html @@ -76,8 +76,7 @@ signals you must know what you're doing. </p><p> The <code>@java.beans.ConstructorProperties</code> annotation is never generated for a constructor with no arguments. This also explains why <code>@NoArgsConstructor</code> - lacks the <code>suppressConstructorProperties</code> annotation method. The <code>@ConstructorProperties</code> annotation is also omitted for private constructors. The - generated static factory methods also do not get <code>@ConstructorProperties</code>, as this annotation can only be added to real constructors. + lacks the <code>suppressConstructorProperties</code> annotation method. The generated static factory methods also do not get <code>@ConstructorProperties</code>, as this annotation can only be added to real constructors. </p><p> <code>@XArgsConstructor</code> can also be used on an enum definition. The generated constructor will always be private, because non-private constructors aren't legal in enums. You don't have to specify <code>AccessLevel.PRIVATE</code>. |