From 9711d5615e635f8f6562cf1473f020e244d155e8 Mon Sep 17 00:00:00 2001 From: Christian Schuster Date: Fri, 4 Apr 2014 21:18:11 +0200 Subject: [PATCH] #191 extend delegate template to avoid duplicate mapper instantiation --- .../org.mapstruct.ap.model.DecoratorConstructor.ftl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/processor/src/main/resources/org.mapstruct.ap.model.DecoratorConstructor.ftl b/processor/src/main/resources/org.mapstruct.ap.model.DecoratorConstructor.ftl index e160efa12..fac796727 100644 --- a/processor/src/main/resources/org.mapstruct.ap.model.DecoratorConstructor.ftl +++ b/processor/src/main/resources/org.mapstruct.ap.model.DecoratorConstructor.ftl @@ -19,8 +19,12 @@ --> public ${name}() { + this( new ${delegateName}() ); +} + +private ${name}( ${delegateName} delegate ) { <#if invokeSuperConstructor> - super( new ${delegateName}() ); + super( delegate ); - this.delegate = new ${delegateName}(); + this.delegate = delegate; } \ No newline at end of file