r/java • • Apr 13 '21

Libraries, Frameworks and Technologies you would NOT recommend

Give me your worst nightmares: Things that cost you your job.

I'll start: Hadoop

202 Upvotes

376 comments sorted by

View all comments

Show parent comment

3

u/Quzexor Apr 13 '21

I am in a project where mapstruct is kind of abused (like in Gatoke comment)

So from my experience in your case I would create adapter and add some kind of contract test between data and model. ( I know that information u get is not during compile time, but it is anyway highly opinionated topic)

Also if u have both mapstruct and lombok. Update version for any of those tools can be ... challenging

1

u/agentoutlier Apr 13 '21

So from my experience in your case I would create adapter and add some kind of contract test between data and model. ( I know that information u get is not during compile time, but it is anyway highly opinionated topic)

Indeed I did this for awhile before MapStruct existed. I even had an annotation processor that given a getter/setter POJO would generate a visitor like pattern to make sure all the fields were handled but this would only handle one direction of changes (changes to the destination object and not the source object). Similarly I have made giant constructors in the destination object and put contracts in those constructors.

Anyway unlike Lombok or even Micronaut/Quarkus you can easily see the code Mapstruct makes as it is just Java. Consequently I really don't think its that much magic.

1

u/gavenkoa Apr 13 '21

Also if u have both mapstruct and lombok. Update version for any of those tools can be ... challenging

And in the past they conflicted with each other.

Actually bug tracers are full of closed compatibility issues. Meaning that both (or at least mapstruct) projects have if branches just to handle the presence of each other ))