Skip to content

Support default primitive values for Kotlin #1075

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

Open
wants to merge 2 commits into
base: 2.15.x
Choose a base branch
from
Open

Support default primitive values for Kotlin #1075

wants to merge 2 commits into from

Conversation

dstepanov
Copy link
Contributor

Fixes #1073

@dstepanov dstepanov added the type: bug Something isn't working label Apr 9, 2025
@dstepanov dstepanov requested review from graemerocher and yawkat April 9, 2025 09:31
this.mustSetField = argument.isNonNull() || type.equals(Optional.class)
this.nonNull = argument.isNonNull();
this.nullable = argument.isNullable();
this.mustSetField = nonNull && !nullable || type.equals(Optional.class)
Copy link
Member

Choose a reason for hiding this comment

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

please add parentheses, i always get confused by how a && b || c evaluates

this.mustSetFieldForConstructor = mustSetField || argument.isPrimitive();
this.nonNull = argument.isNonNull();
this.nullable = argument.isNullable();
this.mustSetFieldForConstructor = mustSetField || argument.isPrimitive() && !nullable; // Kotlin primitives with defaults can be nullable
Copy link
Member

Choose a reason for hiding this comment

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

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants