From 237c337ed13467376f30dd3a013c15ff7dea4b1c Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Sat, 18 Jul 2009 02:51:46 +0200 Subject: No constructor entry should be made for assigned final fields --- src/lombok/eclipse/handlers/HandleData.java | 2 +- src/lombok/javac/handlers/HandleData.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lombok') diff --git a/src/lombok/eclipse/handlers/HandleData.java b/src/lombok/eclipse/handlers/HandleData.java index 73ff79b4..5542dd58 100644 --- a/src/lombok/eclipse/handlers/HandleData.java +++ b/src/lombok/eclipse/handlers/HandleData.java @@ -119,7 +119,7 @@ public class HandleData implements EclipseAnnotationHandler { if ( (fieldDecl.modifiers & ClassFileConstants.AccTransient) == 0 ) nodesForEquality.add(child); boolean isFinal = (fieldDecl.modifiers & ClassFileConstants.AccFinal) != 0; nodesForToString.add(child); - if ( isFinal ) nodesForConstructor.add(child); + if ( isFinal && fieldDecl.initialization == null ) nodesForConstructor.add(child); new HandleGetter().generateGetterForField(child, annotationNode.get()); if ( !isFinal ) new HandleSetter().generateSetterForField(child, annotationNode.get()); } diff --git a/src/lombok/javac/handlers/HandleData.java b/src/lombok/javac/handlers/HandleData.java index 41165600..97a90d85 100644 --- a/src/lombok/javac/handlers/HandleData.java +++ b/src/lombok/javac/handlers/HandleData.java @@ -87,7 +87,7 @@ public class HandleData implements JavacAnnotationHandler { if ( (fieldFlags & Flags.TRANSIENT) == 0 ) nodesForEquality = nodesForEquality.append(child); boolean isFinal = (fieldFlags & Flags.FINAL) != 0; nodesForToString = nodesForToString.append(child); - if ( isFinal ) nodesForConstructor = nodesForConstructor.append(child); + if ( isFinal && fieldDecl.init == null ) nodesForConstructor = nodesForConstructor.append(child); new HandleGetter().generateGetterForField(child, annotationNode.get()); if ( !isFinal ) new HandleSetter().generateSetterForField(child, annotationNode.get()); } -- cgit