aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lombok/eclipse/handlers/HandleData.java2
-rw-r--r--src/lombok/javac/handlers/HandleData.java2
-rw-r--r--usage_examples/GetterSetterExample_post.jpage2
-rw-r--r--usage_examples/GetterSetterExample_pre.jpage2
4 files changed, 4 insertions, 4 deletions
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<Data> {
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<Data> {
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());
}
diff --git a/usage_examples/GetterSetterExample_post.jpage b/usage_examples/GetterSetterExample_post.jpage
index b0921b86..b99ba7e1 100644
--- a/usage_examples/GetterSetterExample_post.jpage
+++ b/usage_examples/GetterSetterExample_post.jpage
@@ -3,7 +3,7 @@ public class GetterSetterExample {
private String name;
@Override public String toString() {
- return String.format("%s (age: %d)", age, name);
+ return String.format("%s (age: %d)", name, age);
}
public int getAge() {
diff --git a/usage_examples/GetterSetterExample_pre.jpage b/usage_examples/GetterSetterExample_pre.jpage
index 0da1d2e2..c40ec106 100644
--- a/usage_examples/GetterSetterExample_pre.jpage
+++ b/usage_examples/GetterSetterExample_pre.jpage
@@ -7,6 +7,6 @@ public class GetterSetterExample {
private @Setter(AccessLevel.PROTECTED) String name;
@Override public String toString() {
- return String.format("%s (age: %d)", age, name);
+ return String.format("%s (age: %d)", name, age);
}
}