Closed ffroliva closed 2 years ago
Did you fix the problem, I have the same bug in version 14.2.Final In version 1.5.0.Beta1, code compiles, but unit tests indicate StackOverflow
For the time being, I simply removed the builder from my class which was unfortunate! That's how I went forward!
This bug from what I could understand needs to be fixed within MapStruct Annotation Processor engine.
As I said, if I introduce generics to CycleAvoidingMappingContext
the getMappedInstance
method from the context
instance no longer gets introduced in the beginning of the converter. That's why you are probably facing this Stackoverflow.
I have the same problem in version 1.4.2.Final with lombok 1.18.12
When you are using builders the lifecycles are treated slightly differently have a look at https://github.com/mapstruct/mapstruct/issues/1454.
For the time being, I simply removed the builder from my class which was unfortunate! That's how I went forward!
You don't have to do that. You can always use something like;
@BeanMapping( builder = @Builder( disableBuilder = true ) )
@Mapper(builder = @Builder(disableBuilder = true))
I am going to close this issue since the relevant things around this are in https://github.com/mapstruct/mapstruct/issues/1454
Hi,
I have a bidirectional mapping Father <--> Children and I decided to try to use this
CycleAvoidingMappingContext
from the example: https://github.com/mapstruct/mapstruct-examples/blob/master/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/CycleAvoidingMappingContext.javaI have a builder class in my Entity and DTO from Lombok but I believe the problem seems to happen also without it.
When the MapperStruct processor created the Mapper Implementation the context object is trying to use the Entity/DTO Builder as the actual
targetType
which caused compilation error.I have created a sample project that reproduces the problem. Please have a look.
mapstruct-mapping-with-cycles.zip
I tried to introduce generics to the
CycleAvoidingMappingContext
to eliminate this problem but it didn't help? When I introduced generics and removed the@TargetType Class<T> targetType
fromgetMappedInstance
method the Mapper implementation no longer is added to the Mapper implementation.Any Ideas?
Regards,
Flávio Oliva