diff options
author | Roel Spilker <r.spilker@gmail.com> | 2015-09-24 00:28:57 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2015-09-24 00:28:57 +0200 |
commit | 9fbc226e090b1ca1efef5e10fd1bd13c4a686cfd (patch) | |
tree | c6e2740f8fae81b97629e649459fd7f89deb6863 /src/core | |
parent | 1bc73d770345f480cee9718618e936dd68499e23 (diff) | |
download | lombok-9fbc226e090b1ca1efef5e10fd1bd13c4a686cfd.tar.gz lombok-9fbc226e090b1ca1efef5e10fd1bd13c4a686cfd.tar.bz2 lombok-9fbc226e090b1ca1efef5e10fd1bd13c4a686cfd.zip |
[Closes #928] `@Value` no longer makes uninitialized static fields final
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleFieldDefaults.java | 4 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleFieldDefaults.java | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java index 7d0702db..33e796b7 100644 --- a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java +++ b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java @@ -96,7 +96,9 @@ public class HandleFieldDefaults extends EclipseAnnotationHandler<FieldDefaults> if (makeFinal && (field.modifiers & ClassFileConstants.AccFinal) == 0) { if (!hasAnnotation(NonFinal.class, fieldNode)) { - field.modifiers |= ClassFileConstants.AccFinal; + if ((field.modifiers & ClassFileConstants.AccStatic) == 0 || field.initialization != null) { + field.modifiers |= ClassFileConstants.AccFinal; + } } } diff --git a/src/core/lombok/javac/handlers/HandleFieldDefaults.java b/src/core/lombok/javac/handlers/HandleFieldDefaults.java index 335ab1fe..95effded 100644 --- a/src/core/lombok/javac/handlers/HandleFieldDefaults.java +++ b/src/core/lombok/javac/handlers/HandleFieldDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2014 The Project Lombok Authors. + * Copyright (C) 2012-2015 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -90,7 +90,9 @@ public class HandleFieldDefaults extends JavacAnnotationHandler<FieldDefaults> { if (makeFinal && (field.mods.flags & Flags.FINAL) == 0) { if (!hasAnnotationAndDeleteIfNeccessary(NonFinal.class, fieldNode)) { - field.mods.flags |= Flags.FINAL; + if ((field.mods.flags & Flags.STATIC) == 0 || field.init != null) { + field.mods.flags |= Flags.FINAL; + } } } |