fashuser
fashuser

Reputation: 1479

Lombok @RequiredArgsConstructor(onConstructor_ = {@MyAnnotation}) compilation error with IntelliJ IDEA

I have following set up on my mac:

Also, I've enabled Annotation Processors as it was suggested here

But I still have following compilation error:

Cannot resolve method 'onConstructor_'

Please suggest which configurations are missing.

Upvotes: 2

Views: 8631

Answers (2)

mahesh chakravarthi
mahesh chakravarthi

Reputation: 271

Please make sure you have enabled annotation processing and added the lombok plugin in IntelliJ IDEA. This should solve the issue in most of the cases. Below is mentioned in the documentation.

 * up to JDK7:<br>
     *  {@code @RequiredArgsConstructor(onConstructor=@__({@AnnotationsGoHere}))}<br>
     * from JDK8:<br>
     *  {@code @RequiredArgsConstructor(onConstructor_={@AnnotationsGohere})} // note the underscore after {@code onConstructor}.

Upvotes: 5

Cepr0
Cepr0

Reputation: 30339

You should use onConstructor parameter like this:

onConstructor=@__({@AnnotationsHere})

See Lombok documentation:

To put annotations on the generated constructor, you can use onConstructor=@__({@AnnotationsHere})

Upvotes: 4

Related Questions