diff options
5 files changed, 5 insertions, 0 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index e98ae4b6..a0de9c4f 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -7,6 +7,7 @@ Lombok Changelog * FEATURE: Lombok's `@NonNull` annotation can now be used on types (annotation on types has been introduced in JDK 8). `@Builder`'s `@Singular` annotation now properly deals with annotations on the generics type on the collection: `@Singular List<@NonNull String> names;` now does the right thing. * FEATURE: You can now mix `@SuperBuilder` and `toBuilder`, and `toBuilder` no longer throws `NullPointerException` if an `@Singular`-marked collection field is `null`. [Issue #1324](https://github.com/rzwitserloot/lombok/issues/1324) * BREAKING CHANGE: Lombok will now always copy specific annotations around (from field to getter, from field to builder 'setter', etcetera): A specific curated list of known annotations where that is the right thing to do (generally, `@NonNull` style annotations from various libraries), as well as any annotations you explicitly list in the `lombok.copyableAnnotations` config key in your `lombok.config` file. Also, lombok is more consistent about copying these annotations. (Previous behaviour: Lombok used to copy any annotation whose simple name was `NonNull`, `Nullable`, or `CheckForNull`). [Issue #1570](https://github.com/rzwitserloot/lombok/issues/1570) and [Issue #1634](https://github.com/rzwitserloot/lombok/issues/1634) +* BUGFIX: `@NoArgsConstructor(force=true)` would try to initialize already initialized final fields in Eclipse. [Issue #1829](https://github.com/rzwitserloot/lombok/issues/1829) * BUGFIX: When using lombok to compile modularized (`module-info.java`-style) code, if the module name has dots in it, it wouldn't work. [Issue #1808](https://github.com/rzwitserloot/lombok/issues/1808) * BUGFIX: Errors about lombok not reading a module providing `org.mapstruct.ap.spi` when trying to use lombok in jigsaw-mode on JDK 11. [Issue #1806](https://github.com/rzwitserloot/lombok/issues/1806) * BUGFIX: Fix NetBeans compile on save. [Issue #1770](https://github.com/rzwitserloot/lombok/issues/1770) diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index cb07115a..82859e4b 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -484,6 +484,7 @@ public class HandleConstructor { for (EclipseNode node : type.down()) { if (node.getKind() != Kind.FIELD) continue top; FieldDeclaration fd = (FieldDeclaration) node.get(); + if (fd.initialization != null) continue top; if ((fd.modifiers & ClassFileConstants.AccFinal) == 0) continue top; if ((fd.modifiers & ClassFileConstants.AccStatic) != 0) continue top; for (EclipseNode ftp : fieldsToParam) if (node == ftp) continue top; diff --git a/test/transform/resource/after-delombok/NoArgsConstructorForce.java b/test/transform/resource/after-delombok/NoArgsConstructorForce.java index 3336ca19..d4bfcda2 100644 --- a/test/transform/resource/after-delombok/NoArgsConstructorForce.java +++ b/test/transform/resource/after-delombok/NoArgsConstructorForce.java @@ -3,6 +3,7 @@ public class NoArgsConstructorForce { private final int[] i; private final Object[] o; private final java.util.List<?>[] fullQualifiedList; + private final String alreadyInitialized = "yes"; @java.lang.SuppressWarnings("all") public NoArgsConstructorForce() { diff --git a/test/transform/resource/after-ecj/NoArgsConstructorForce.java b/test/transform/resource/after-ecj/NoArgsConstructorForce.java index 850aa8a5..59713673 100644 --- a/test/transform/resource/after-ecj/NoArgsConstructorForce.java +++ b/test/transform/resource/after-ecj/NoArgsConstructorForce.java @@ -3,6 +3,7 @@ public @NoArgsConstructor(force = true) class NoArgsConstructorForce { private final int[] i; private final Object[] o; private final java.util.List<?>[] fullQualifiedList; + private final String alreadyInitialized = "yes"; public @java.lang.SuppressWarnings("all") NoArgsConstructorForce() { super(); this.i = null; diff --git a/test/transform/resource/before/NoArgsConstructorForce.java b/test/transform/resource/before/NoArgsConstructorForce.java index 48df1a37..6193eb0a 100644 --- a/test/transform/resource/before/NoArgsConstructorForce.java +++ b/test/transform/resource/before/NoArgsConstructorForce.java @@ -5,4 +5,5 @@ public class NoArgsConstructorForce { private final int[] i; private final Object[] o; private final java.util.List<?>[] fullQualifiedList; + private final String alreadyInitialized = "yes"; }
\ No newline at end of file |