Skip to content

Refactor gradle API#5598

Open
terrakok wants to merge 1 commit into
masterfrom
CMP-10189
Open

Refactor gradle API#5598
terrakok wants to merge 1 commit into
masterfrom
CMP-10189

Conversation

@terrakok
Copy link
Copy Markdown
Member

@terrakok terrakok commented May 11, 2026

Migrate from nullableProperty to notNullProperty for improved property handling. Remove deprecated nullableProperty utility.

Fixes https://youtrack.jetbrains.com/issue/CMP-10189

Release Notes

N/A

…perty handling. Remove deprecated `nullableProperty` utility.
@terrakok terrakok requested a review from MatkovIvan May 11, 2026 17:15
Copy link
Copy Markdown
Contributor

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

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

Public API change. Requires release notes + second approval

(and green CI)

newInstance(T::class.java, *params)

@SuppressWarnings("UNCHECKED_CAST")
internal inline fun <reified T : Any> ObjectFactory.nullableProperty(): Property<T?> =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Did you check that all values that returned nullable are handled properly with isPresent or orNull?

internal inline fun <reified T : Any> ObjectFactory.nullableProperty(): Property<T?> =
property(T::class.java) as Property<T?>

internal inline fun <reified T : Any> ObjectFactory.notNullProperty(): Property<T> =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

notNull is misleading if all properties considered not null.

It looks like we can just rename it to property

provider {
gradleProperty(prop).orNull
}
internal fun ProviderFactory.valueOrNull(prop: String): Provider<String> =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is misleading now if we can't have null properties. Let's just remove it and use gradleProperty directly

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