sonar-scanner-gradle
sonar-scanner-gradle copied to clipboard
Make value of SonarProperties#property nullable
I'm porting a Groovy DSL build to Kotlin DSL.
Before I did things like
property('foo', [...] ?: null)
to override foo
and either set it to some value or unset it otherwise.
In Kotlin DSL you cannot do
property("foo", listOf(...).takeIf { it.isNotEmpty() })
currently due to the @ParametersAreNonnullByDefault
in the package-info.java
and Kotlin respecting that, so having the value parameter non-nullable.
Work-around is to use
properties["foo"] = listOf(...).takeIf { it.isNotEmpty() }
or
listOf(...).also { if (it.isNotEmpty()) property("foo", it) else properties.remove("foo") }
This PR makes the value parameter nullable, so you can also use the first Kotlin snippet above.