Hello! Do you all use mapstruct? It’s giving us is...
# getting-started
a
Hello! Do you all use mapstruct? It’s giving us issues when we try to move from kotlin 1.4 to kotlin 1.6 and I’m wondering if the community is simply not using mapstruct or if you are and we’re just doing something wrong. If you’re not using it, do you write the mappers by hand or use something else? Thank you!
j
We write mappers by hand. Mostly due to not finding a good mapping component for KMM.
t
We used to generate our mappers with mapstruct. We started that before migrating from Java to Kotlin. With Kotlin, the pains of using Mapstruct just grew (nullability, generic projection, kapt not working in IntelliJ...). Also, the mapstruct definitions got more and more complex and in some places it got hard to really see what's happening in the mapping withoput looking at the generated code. On the other hand, esp. with the use of Kotlin data classes and extension functions, it got easier and much more readable to just write the mappings manually. So that's what we do today. Today I wouldn't recommend Mapstruct to anyone. If your mappings are complex, Mapstruct mappers will be hard to understand; if they are simple, then it's very easy to write them manually and you don't benefit from the generation very much.
164 Views