Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] add javadoc to fields and props of a java record #3453

Closed
nimo23 opened this issue Jul 6, 2023 · 5 comments
Closed

[FEATURE] add javadoc to fields and props of a java record #3453

nimo23 opened this issue Jul 6, 2023 · 5 comments
Labels

Comments

@nimo23
Copy link

nimo23 commented Jul 6, 2023

Describe the feature

Imagine something like this:

/**
 * @param firstname   the firstname
 * @param surname     the surname
 * @param tasks       all tasks of the user
*/
public record User(String firstname, String surname, List<Taks> tasks){}

It would be nice if lombok could add the javadoc based on the constructor's javadoc. For example, when accessing user.firstname(), the javadoc defined in the constructor should be used. Is this possible?

Actually, lombok uses the javadoc defined in fields when we use getter/setter-methods generated by @Getter/@Setter. Something like this would be good for Java record as well.

@Rawi01
Copy link
Collaborator

Rawi01 commented Sep 3, 2023

If the javadoc tool or your IDE does not support something like this, I would recommend filling an issue in the appropriate issue tracker. There is no reason lombok should modify a record without a lombok annotation.

@Rawi01 Rawi01 closed this as completed Sep 3, 2023
@nimo23
Copy link
Author

nimo23 commented Sep 3, 2023

There is no reason lombok should modify a record without a lombok annotation.

@Rawi01 I think, you did not understand this issue. It should not modify a record, it only should provide the javadoc to its "getters". Actually, records automatically generate the "getters" but does not have a javadoc for that field. Lombok also associates the javadoc for getter/setters of a common class if the field has a javadoc defined. That's what I am talking about.

@nimo23
Copy link
Author

nimo23 commented Sep 3, 2023

If the javadoc tool or your IDE does not support something like this, I would recommend filling an issue in the appropriate issue tracker.

But I also think that the IDE (in this case Eclipse) should support such things out of the box.

@Rawi01
Copy link
Collaborator

Rawi01 commented Sep 3, 2023

Adding comments is some kind of modification. Lombok can do that, yes, but shouldn't that be part of the java standard/IDE?

According to this stackoverflow post it works in javadoc and IntelliJ. I doesn't work in eclipse for me too, only adding a comment at the record component itself seems to work (record User(/** comment */ String name, ...)).

Github only know open or closed as status but I added a label to the issue for you 😃

@Rawi01 Rawi01 added the wontfix label Sep 3, 2023
@nimo23
Copy link
Author

nimo23 commented Sep 3, 2023

only adding a comment at the record component itself seems to work (record User(/** comment */ String name, ...)).

@Rawi01 Thanks! I didn't know that. That is perfectly sufficient 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants