Don't initialize already initialized final fields. Fixes #1829.

This commit is contained in:
Roel Spilker committed 2018-10-15 22:37:37 +02:00
1 parent 11322a489b
commit 7ee4ebb1a5
5 files changed
+5

No files matched your search

+1
View File
@@ -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)
@@ -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;
@@ -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() {
@@ -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;
@@ -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";
}