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

#107 #108

Closed
wants to merge 9 commits into from
Closed

#107 #108

wants to merge 9 commits into from

Conversation

lpandzic
Copy link
Contributor

Fixes #107

@Randgalt
Copy link
Owner

I will review soon - thanks

methodSpec.addStatement("return this").addParameter(parameterSpecBuilder.build());
builder.addMethod(methodSpec.build());
}

private void filterOutNotNullAnnotationOnParameter(ParameterSpec.Builder parameterSpecBuilder) {
Copy link
Owner

Choose a reason for hiding this comment

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

I feel that this portion should be in a different PR. Let's focus this PR solely on the ofNullable. wdyt?

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 agree since the issue discussion has gone off on a tangent.
But the issue this tries to solve is when there's a @NotNull Optional field in record.
In that case current code without the method above would generate

setX(@NotNull X x) {
    Optional.ofNullable(x);
}

This isn't a problem in my company code base because we never validate builders but it will surprise some.
I've reverted the commit that adds this filter.

Copy link
Owner

Choose a reason for hiding this comment

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

I want to handle the null issue finally and completely which I hope to do with #111 - people seem to have strong opinions on this :D

@Randgalt
Copy link
Owner

Randgalt commented May 7, 2022

I apologize it's taken me so long to look at this. I left a comment for you to reply to.

@Randgalt
Copy link
Owner

Randgalt commented May 9, 2022

Please rebase the commits

@lpandzic
Copy link
Contributor Author

lpandzic commented May 9, 2022

Please rebase the commits

done

@Randgalt
Copy link
Owner

Please rebase the commits

done

I still see 7 commits. Did you force push your squash?

@lpandzic
Copy link
Contributor Author

I'm not sure I follow - my branch has 7 commits that are ahead of the master. I don't see any commits on master that are not present in my branch.

@Randgalt
Copy link
Owner

Please squash down to 1 commit.

lpandzic added 2 commits May 10, 2022 15:14
removed concreteSetterForOptionalShouldNotHaveNotNullAnnotation

Revert "implemented removal of NotNull on concrete setter for Optional"

This reverts commit ff3ac3a.

implemented removal of NotNull on concrete setter for Optional

added test that concrete Optional setter doesnt copy NotNull

changed InternalRecordBuilderProcessor to pass shouldAcceptNullForOptionalRawSetter

added shouldAcceptNullForOptionalRawSetter test to TestOptional
@lpandzic lpandzic closed this May 10, 2022
@lpandzic lpandzic deleted the #107 branch May 10, 2022 13:17
@lpandzic
Copy link
Contributor Author

#112

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

Successfully merging this pull request may close these issues.

null values and addConcreteSettersForOptional
2 participants