Kelvin Chung
04/19/2024, 11:17 PMabstract class AbstractMyTask : DefaultTask() {
abstract val base: Provider<String>
private val derived = base.map { ... }
}
abstract class MyTask : AbstractMyTask {
override val base = ...
}
It seems Gradle is unable to create MyTask instances due to a NullPointerException on derived in AbstractMyTask. Is this a known thing?Vampire
04/19/2024, 11:45 PMAbstractMyTask is initialized and later MyTask.
So the time derived is initialized the overridden base in MyTask is not yet ready.
That's why you should not use overridable properties in initializers or constructors.Kelvin Chung
04/19/2024, 11:46 PM