3

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.

fashuser
  • 2,152
  • 3
  • 29
  • 51

2 Answers2

4

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}.
3

You should use onConstructor parameter like this:

onConstructor=@__({@AnnotationsHere})

See Lombok documentation:

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

Cepr0
  • 28,144
  • 8
  • 75
  • 101
  • Thanks for reply. It looks like that proposed approach related to java 7. I've found following in documentation: https://projectlombok.org/api/index.html?lombok/RequiredArgsConstructor.html. Actually, new styling should be used starting from JDK8. – fashuser Jul 02 '18 at 17:27
  • proposed parameter works fine, thank you, in any way I am still confused :), since legacy code base using styling mentioned in original question. I am not sure whether this problem on my side or it is some open issue in lombok plugin. – fashuser Jul 02 '18 at 17:34
  • I suppose it's a mistype in their java-doc. On their site documentation there is only one option. (Don't forget to accept/upvote the answer if it was helpful...) – Cepr0 Jul 02 '18 at 17:38