Skip to first unread message

Mat Jaggard

Jun 18, 2021, 12:29:05 PM6/18/21
to Project Lombok
Would it be possible to add additional configuration to copyableAnnotations to allow me to copy Jackson's @JsonIgnore to the places it is allowed but not those it is not - specifically in this case it is allowed on methods, fields and constructors but not on parameters so I'd like it copied to the setter but not the parameter to the setter for example.

Ideally it would be great if this was auto-detected but I know that will be hard, but I'd be fine with it being configurable.

Maybe a key like copyableXXXXAnnotations for each location that it could be copied?

Reinier Zwitserloot

Jun 18, 2021, 1:07:19 PM6/18/21
to Project Lombok
It feels like turning lombok.config into a shitty DSL that lets you configure all this is something everybody involved would find an ugly hacky disaster.

So, no, I don't think that's a good idea.

However, I have no problem 'hardcoding' knowledge about commonly used types in lombok core itself. I get that it doesn't really scale, and I'm all ears that we, internally, in lombok's own source repo, have a list that does have the ability to explain precisely where it is and isn't legal and where it should and shouldn't be copied, so that maintainers of other libraries have as easy a job as we can make it to add their annotations to this list, but let's not have all lombok users first read 4 pages worth to figure out how to write a lombok.config file to get it right, and then read the manual of whereever this annotation is from to make sure it all adds up, and then pray future versions of said library don't expand on the annotations' targets.

In other words, to answer your question: No, not possible. But what IS possible is that we just let lombok know what `@JsonIgnore` means. We already have a bunch of support for a bunch of jackson annotations, heck, I'm half surprised this doesn't already work right. See - we already hardcode info about this annotation and how it should be copied. If lombok is not applying the right copying behaviour for JsonIgnore, that'd be a bug, and we need to fix it (primarily by shuffling it around in this linked source file).

Mat Jaggard

Jun 18, 2021, 6:24:29 PM6/18/21
to project-lombok
That makes perfect sense and I was starting to feel nauseous as I was suggesting the properties approach. In my previous job we used immutable value classes with @SuperBuilder which works perfectly (thanks!) but in my new job I've got a whole different setup and it doesn't quite work correctly. I'll have a look on Monday to see how that code works and whether I can fix it.

Thanks again.

You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages