Search code examples
intellij-ideajava-8lombokintellij-lombok-plugin

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


I have following set up on my mac:

  • IntelliJ IDEA Ultimate: 2018.1
  • Lombok Plugin Version: 0.18-2018.1
  • Java: 1.8.0_111

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.


Solution

  • You should use onConstructor parameter like this:

    onConstructor=@__({@AnnotationsHere})
    

    See Lombok documentation:

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