diff options
5 files changed, 17 insertions, 3 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java index 2cdfdd4d..0cce0f62 100644 --- a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java +++ b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java @@ -89,6 +89,8 @@ public class HandleFieldDefaults extends EclipseAnnotationHandler<FieldDefaults> field.modifiers |= ClassFileConstants.AccFinal; } } + + fieldNode.rebuild(); } public void handle(AnnotationValues<FieldDefaults> annotation, Annotation ast, EclipseNode annotationNode) { diff --git a/src/core/lombok/eclipse/handlers/HandleValue.java b/src/core/lombok/eclipse/handlers/HandleValue.java index a1eb24ff..612f218b 100644 --- a/src/core/lombok/eclipse/handlers/HandleValue.java +++ b/src/core/lombok/eclipse/handlers/HandleValue.java @@ -57,7 +57,12 @@ public class HandleValue extends EclipseAnnotationHandler<Value> { } // Make class final. - if (!hasAnnotation(NonFinal.class, typeNode)) typeDecl.modifiers |= ClassFileConstants.AccFinal; + if (!hasAnnotation(NonFinal.class, typeNode)) { + if ((typeDecl.modifiers & ClassFileConstants.AccFinal) == 0) { + typeDecl.modifiers |= ClassFileConstants.AccFinal; + typeNode.rebuild(); + } + } new HandleFieldDefaults().generateFieldDefaultsForType(typeNode, annotationNode, AccessLevel.PRIVATE, true, true); diff --git a/src/core/lombok/javac/handlers/HandleExtensionMethod.java b/src/core/lombok/javac/handlers/HandleExtensionMethod.java index 68df38ef..717afbc5 100644 --- a/src/core/lombok/javac/handlers/HandleExtensionMethod.java +++ b/src/core/lombok/javac/handlers/HandleExtensionMethod.java @@ -99,7 +99,7 @@ public class HandleExtensionMethod extends JavacAnnotationHandler<ExtensionMetho if (providerType == null) continue; if ((providerType.tsym.flags() & (INTERFACE | ANNOTATION)) != 0) continue; - extensions.add(getExtension(typeNode, (ClassType) providerType)); + extensions.add(getExtension(typeNode, (ClassType) providerType)); } return extensions; } diff --git a/src/core/lombok/javac/handlers/HandleFieldDefaults.java b/src/core/lombok/javac/handlers/HandleFieldDefaults.java index c0829172..d32446c3 100644 --- a/src/core/lombok/javac/handlers/HandleFieldDefaults.java +++ b/src/core/lombok/javac/handlers/HandleFieldDefaults.java @@ -91,6 +91,8 @@ public class HandleFieldDefaults extends JavacAnnotationHandler<FieldDefaults> { field.mods.flags |= Flags.FINAL; } } + + fieldNode.rebuild(); } @Override public void handle(AnnotationValues<FieldDefaults> annotation, JCAnnotation ast, JavacNode annotationNode) { diff --git a/src/core/lombok/javac/handlers/HandleValue.java b/src/core/lombok/javac/handlers/HandleValue.java index b52bad7c..8b0b9568 100644 --- a/src/core/lombok/javac/handlers/HandleValue.java +++ b/src/core/lombok/javac/handlers/HandleValue.java @@ -35,6 +35,7 @@ import org.mangosdk.spi.ProviderFor; import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCClassDecl; +import com.sun.tools.javac.tree.JCTree.JCModifiers; /** * Handles the {@code lombok.Value} annotation for javac. @@ -55,7 +56,11 @@ public class HandleValue extends JavacAnnotationHandler<Value> { String staticConstructorName = annotation.getInstance().staticConstructor(); if (!hasAnnotationAndDeleteIfNeccessary(NonFinal.class, typeNode)) { - ((JCClassDecl) typeNode.get()).mods.flags |= Flags.FINAL; + JCModifiers jcm = ((JCClassDecl) typeNode.get()).mods; + if ((jcm.flags & Flags.FINAL) == 0) { + jcm.flags |= Flags.FINAL; + typeNode.rebuild(); + } } new HandleFieldDefaults().generateFieldDefaultsForType(typeNode, annotationNode, AccessLevel.PRIVATE, true, true); |