34

I am having a problem with generating Javadoc for Lombok getters and setters. I have tried both suggestions here. An example field and its text are as follows:

/**  
 *  Identifier of the client
 * 
 *  @param clientID changes the id of the client 
 *  @return id of the client
 */
@Getter @Setter private Integer clientID;

However, I see neither the getter nor the setter in the generated Javadoc. I am using 'protected' visibility on Eclipse (Project -> Generate Javadoc...). My Lombok version is 1.12.4. Any suggestions?

Egemen
  • 2,178
  • 5
  • 22
  • 32

1 Answers1

33

The javadoc feature does not work in the eclipse javadoc view or hovers. You can generate the javadoc by running delombok on the code first and then run the javadoc compiler, as is hinted on the feature page near the bottom.

Disclosure: I am a Lombok developer.

Roel Spilker
  • 32,258
  • 10
  • 68
  • 58
  • 2
    Is there any chance to integrate that into the eclipse plugin? It would be very nice to have the javadoc of the fields on the setters and getters. – James Oct 28 '15 at 12:31
  • 1
    The core lombok maintainers did look into it, but the Eclipse AST for javadoc is complex, and IIRC has changed significantly bewteen versions making it hard to maintain. – Roel Spilker Oct 29 '15 at 09:35
  • 3
    Sorry to know this. This issue is keeping our team from using Lombok. – ntysdd Mar 28 '17 at 05:04
  • Will a batch command to `delombok all - generate javadoc - undo delombok all` do the trick? – Leon Mar 26 '18 at 08:52
  • 14
    I have a suggestion, why not adding an annotation @Doc that will generate the documentation for the field and the methods !!! is it possible ?? – Mohammed Housseyn Taleb Sep 27 '18 at 17:32
  • 3
    I find Lombok one of the MUST-HAVE libraries in a Java project. The unique thing I miss is a '@Doc' annotation to generate documentation for setters and getters. – joninx Apr 09 '20 at 10:07
  • Clarification: The Javadoc is generated, but Eclipse doesn't see it. IntelliJ gets along with the generated Javadoc just fine. – Egor Hans Mar 21 '22 at 07:40