Propagate option deprecation to options impl class

This is to avoid the new warning OVERRIDE_DEPRECATION that is reported
when a base method is deprecated and an overriding method is not.
This commit is contained in:
Ilya Gorbunov
2021-09-29 11:10:12 +03:00
committed by TeamCityServer
parent 7917e511ed
commit bd856ad726
@@ -202,11 +202,13 @@ private fun Printer.generateImpl(
println()
val propertyType = property.gradleReturnType
if (propertyType.endsWith("?")) {
generateOptionDeprecation(property)
generatePropertyDeclaration(property, modifiers = "override", value = "null")
} else {
val backingField = property.backingField()
val visibilityModified = property.gradleBackingFieldVisibility.name.lowercase(Locale.US)
println("$visibilityModified var $backingField: $propertyType? = null")
generateOptionDeprecation(property)
generatePropertyDeclaration(property, modifiers = "override")
withIndent {
println("get() = $backingField ?: ${property.gradleDefaultValue}")