From 44759212f52c1b85e6cbb00b554f2cfdc730e645 Mon Sep 17 00:00:00 2001 From: Dusan Klinec Date: Thu, 8 Dec 2016 20:35:09 +0100 Subject: [PATCH] property factory fixes (mergeFromSuperBuilder) --- .../processor/ListMultimapPropertyFactory.java | 9 ++++----- .../freebuilder/processor/ListPropertyFactory.java | 6 ++++-- .../freebuilder/processor/MapPropertyFactory.java | 3 +-- .../freebuilder/processor/MultisetPropertyFactory.java | 5 ++--- .../processor/SetMultimapPropertyFactory.java | 3 +-- .../freebuilder/processor/SetPropertyFactory.java | 3 +-- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/inferred/freebuilder/processor/ListMultimapPropertyFactory.java b/src/main/java/org/inferred/freebuilder/processor/ListMultimapPropertyFactory.java index 9703f3a12..88fa67f46 100644 --- a/src/main/java/org/inferred/freebuilder/processor/ListMultimapPropertyFactory.java +++ b/src/main/java/org/inferred/freebuilder/processor/ListMultimapPropertyFactory.java @@ -389,11 +389,10 @@ public void addMergeFromBuilder(Block code, String builder) { @Override public void addMergeFromSuperBuilder(Block code, String builder) { - code.addLine("%s(((%s) %s).%s());", - putAllMethod(property), - metadata.getGeneratedBuilder(), - builder, - getter(property)); + code.addLine("%s(%s.%s());", + putAllMethod(property), + builder, + getter(property)); } @Override diff --git a/src/main/java/org/inferred/freebuilder/processor/ListPropertyFactory.java b/src/main/java/org/inferred/freebuilder/processor/ListPropertyFactory.java index 4f2e4c9e3..537f6608d 100644 --- a/src/main/java/org/inferred/freebuilder/processor/ListPropertyFactory.java +++ b/src/main/java/org/inferred/freebuilder/processor/ListPropertyFactory.java @@ -369,8 +369,10 @@ public void addMergeFromBuilder(Block code, String builder) { @Override public void addMergeFromSuperBuilder(Block code, String builder) { - Excerpt base = new Block(code).add(builder); - code.addLine("%s(%s.%s());", addAllMethod(property), base, getter(property)); + code.addLine("%s(%s.%s());", + addAllMethod(property), + builder, + getter(property)); } @Override diff --git a/src/main/java/org/inferred/freebuilder/processor/MapPropertyFactory.java b/src/main/java/org/inferred/freebuilder/processor/MapPropertyFactory.java index fe341f2f5..f7741384d 100644 --- a/src/main/java/org/inferred/freebuilder/processor/MapPropertyFactory.java +++ b/src/main/java/org/inferred/freebuilder/processor/MapPropertyFactory.java @@ -323,9 +323,8 @@ public void addMergeFromBuilder(Block code, String builder) { @Override public void addMergeFromSuperBuilder(Block code, String builder) { - code.addLine("%s(((%s) %s).%s());", + code.addLine("%s(%s.%s());", putAllMethod(property), - metadata.getGeneratedBuilder(), builder, getter(property)); } diff --git a/src/main/java/org/inferred/freebuilder/processor/MultisetPropertyFactory.java b/src/main/java/org/inferred/freebuilder/processor/MultisetPropertyFactory.java index e6dc39402..4f36a48a6 100644 --- a/src/main/java/org/inferred/freebuilder/processor/MultisetPropertyFactory.java +++ b/src/main/java/org/inferred/freebuilder/processor/MultisetPropertyFactory.java @@ -322,7 +322,7 @@ public void addMergeFromSuperValue(Block code, String value) { @Override public void addMergeFromBuilder(Block code, String builder) { - code.addLine("%s(((%s) %s).%s);", + code.addLine("%s(((%s) %s).%s());", addAllMethod(property), metadata.getGeneratedBuilder(), builder, @@ -331,9 +331,8 @@ public void addMergeFromBuilder(Block code, String builder) { @Override public void addMergeFromSuperBuilder(Block code, String builder) { - code.addLine("%s(((%s) %s).%s());", + code.addLine("%s(%s.%s());", addAllMethod(property), - metadata.getGeneratedBuilder(), builder, getter(property)); } diff --git a/src/main/java/org/inferred/freebuilder/processor/SetMultimapPropertyFactory.java b/src/main/java/org/inferred/freebuilder/processor/SetMultimapPropertyFactory.java index 3b871d189..55b3d9088 100644 --- a/src/main/java/org/inferred/freebuilder/processor/SetMultimapPropertyFactory.java +++ b/src/main/java/org/inferred/freebuilder/processor/SetMultimapPropertyFactory.java @@ -385,9 +385,8 @@ public void addMergeFromBuilder(Block code, String builder) { @Override public void addMergeFromSuperBuilder(Block code, String builder) { - code.addLine("%s(((%s) %s).%s());", + code.addLine("%s(%s.%s());", putAllMethod(property), - metadata.getGeneratedBuilder(), builder, getter(property)); } diff --git a/src/main/java/org/inferred/freebuilder/processor/SetPropertyFactory.java b/src/main/java/org/inferred/freebuilder/processor/SetPropertyFactory.java index 861577e09..a78532fde 100644 --- a/src/main/java/org/inferred/freebuilder/processor/SetPropertyFactory.java +++ b/src/main/java/org/inferred/freebuilder/processor/SetPropertyFactory.java @@ -372,9 +372,8 @@ public void addMergeFromBuilder(Block code, String builder) { @Override public void addMergeFromSuperBuilder(Block code, String builder) { - code.addLine("%s(((%s) %s).%s());", + code.addLine("%s(%s.%s());", addAllMethod(property), - metadata.getGeneratedBuilder(), builder, getter(property)); }