Kotlin uses the data type Unit to represent the absence of a value in a function or an expression. It corresponds to the type
void in Java or unknown in JavaScript. While Void is available in Kotlin, it is a Java platform type and not
equivalent to Java void but java.lang.Void.
Use Unit instead of Void because it represents the absence of a value in Kotlin.
Void is not equivalent to Java void but java.lang.Void.
Void is a platform type available only in the Java Runtime Environment.
Replace Void with Unit.
typealias NoValueFunction = () -> Void // Noncompliant, `Void` used
interface NoValueFunctions {
fun voidFunction1(): Void // Noncompliant, `Void` used
fun voidFunction2(): Void // Noncompliant, `Void` used
}
typealias NoValueFunction = () -> Unit // Compliant, `Unit` used
interface NoValueFunctions {
fun unitFunction1(): Unit // Compliant, `Unit` used
fun unitFunction2() // Compliant, `Unit` used implicitly
}