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

Fix incomplete toBuilder implementations and add tests #85

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Marcono1234
Copy link
Contributor

@Marcono1234 Marcono1234 commented Sep 25, 2024

Description

  • For JavaFile it was not copying staticImports
  • For TypeSpec it was not copying recordConstructor
  • For TypeSpec it was accumulating additional elements in originatingElements from nested types for every toBuilder().build() cycle
  • For ParameterSpec it was not copying javadoc

@palantirtech
Copy link
Member

Thanks for your interest in palantir/javapoet, @Marcono1234! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@Marcono1234 Marcono1234 changed the title Fix incomplete toBuilder methods and add tests Fix incomplete toBuilder implementations and add tests Sep 25, 2024
@Marcono1234
Copy link
Contributor Author

Note: Unless you have a policy to create a release after every change, I would not mind if you wait a bit. I might create another PR as well.

(And these fixes are not that critical that they require immediate releases?)

@@ -205,8 +205,7 @@ public Builder addAnnotation(Class<?> annotation) {
}

public Builder addModifiers(Modifier... modifiers) {
Collections.addAll(this.modifiers, modifiers);
return this;
return addModifiers(Arrays.asList(modifiers));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is a sneaky one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: The FieldSpec and TypeSpec builder currently have a varargs variant only (and no Iterable one), I am a bit afraid the same issue could re-appear there again in case an Iterable overload is added as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to add the Iterable overload for symmetry in this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have included that in #87, I hope that is ok. I will probably revert this addModifiers change here.

@carterkozak
Copy link
Contributor

Note: Unless you have a policy to create a release after every change, I would not mind if you wait a bit. I might create another PR as well.

Our robots make releases trivial -- we generally release from all human-authored commits, releasing one change doesn't make it any less likely we'll cut a release on another PR :-]

@Marcono1234
Copy link
Contributor Author

Our robots make releases trivial -- we generally release from all human-authored commits, releasing one change doesn't make it any less likely we'll cut a release on another PR :-]

Yeah, my concern wasn't so much how easy it is to make a release 😅
Rather if it is really needed. Technically storage on Maven Central is unlimited and free but maybe it would still make sense to be a bit conservative? Also, multiple releases in quick succession might cause overhead for users, especially if they have Dependabot or similar configured (and run it daily). But not sure how big these issues are or if they are even real issues at all, and in the end it is of course your decision.

I just wanted to express that I am not urgently waiting for these changes to be released.

carterkozak
carterkozak previously approved these changes Oct 2, 2024
@carterkozak carterkozak dismissed their stale review October 2, 2024 13:54

This change looks good, please sign the cla

@carterkozak
Copy link
Contributor

This change looks good, thanks! Please complete the cla: #85 (comment)

@Marcono1234
Copy link
Contributor Author

Currently still waiting for an answer to my questions regarding the CLA, see #84 (comment).

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

Successfully merging this pull request may close these issues.

3 participants