-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Copy Javadoc to builder setters #2004
Conversation
Turns out this doesn't play nicely with |
…opying behaviour" This reverts commit e41f14c.
This handler makes a final pass over the source and removes `@return` and `@param` tags as well as `GETTER`/`SETTER`/`WITHER` sections from the docstrings on fields. This changes javadoc behaviour slightly: - `@return` and `@param` tags are now removed even if the generated method got its docstring from a `GETTER`/`SETTER`/`WITHER` section. - `@return` and `@param` tags and `GETTER`/`SETTER`/`WITHER` sections are now always removed from all fields regardless of whether any generated member was created from the field. This should not be a problem for the most part, since `@return` and `@param` tags are normally nonsensical on field members, and `GETTER`/`SETTER`/`WITHER` sections are specific to Lombok.
This, together with the parent commit, means that multiple generated members can now "extract" the same elements from the javadoc on a field. For example, a `@Setter` and a `@Wither` can now both receive a `@param` tag from the javadoc on their defining field, whereas previously the first one to be processed would remove the tag from the field so it didn't show up in the javadoc on the other. This fixes the bug exposed by the test added in commit 480129a.
…escriptive names" This reverts commit 0682705.
There - |
Forum discussion: https://groups.google.com/forum/#!topic/project-lombok/aZx5wJp891k |
This reverts commit f87359d.
This sets up a new map from field nodes to the copy modes of the docstrings for the members generated for that field. Javadoc cleanup is now done only for the field nodes and copy modes in that map, instead of for all field nodes and copy modes. This means that the Javadoc extraction behaviour will remain the same as before. For example, ``` /** * A thing. * @return the thing * @param foo the new thing */ @Setter private Foo foo; ``` will now be expanded to ``` /** * A thing. * @return the thing */ private Foo foo; /** * A thing. * @param foo the new thing */ private void setFoo(final Foo foo) { this.foo = foo; } ``` as in commit ca46f98, instead of being expanded to ``` /** * A thing. */ private Foo foo; /** * A thing. * @param foo the new thing */ private void setFoo(final Foo foo) { this.foo = foo; } ``` as is done in commit f87359d.
In commit ccfab5e I've added a cleanup tasks system for the javac run of lombok. This should make it a lot simpler to fix this problem properly. I've also fixed the setter vs. wither conflict and written a test to show the fix is working, as proof of concept. Would it be okay if you merge/rewrite your PR to use it? I'm pretty sure it's a breeze with this update, just, swamped with work and it was a late evening. Muchos gracias and thanks for putting in the effort to fix this oldie :) Also, can you add your name to the CONTRIBUTORS file in the root of the project? |
Cool, thanks! It indeed looks like this will be a lot simpler with that new infrastructure. I'll close this and open a new PR. |
Fixes #1033. Fixes #1445.
This causes Javadoc to be copied to
@Builder
setters using SETTER copy mode. See the added tests for an example.Notes:
makeSimpleSetterMethodForBuilder
method, so I don't think this will apply to "singular" setters or other special cases - I haven't quite been able to grok how theelse
branch inmakeSetterMethodsForBuilder
method works.@Builder
and@Value
/@Getter
. I'll try to add some for that.