Tóth István Zoltán
01/19/2024, 9:01 AMRuiT0
requires the parameter, so ruiExternalPatch333
must have that parameter. However, as it does not use the parameter (which is a valid use case) a warning appears.
class RuiT0(
val externalPatchFun : (fragment: RuiFragment<TestNode>) -> Unit
)
fun ruiBuilder333() {
RuiT0(this::ruiExternalPatch333)
}
fun ruiExternalPatch333(fragment: RuiFragment<TestNode>) { // <--- `it` shows a warning
}
As far as I know there are two ways to solve this at the moment:
• add an annotation to the parameter or to the function
• disable the warning
Disabling the warning is a clear no-go, it is a very useful warning.
Adding the annotation is technically right but it adds a lot of visual clutter to the code, especially if the function in question has more than one parameters.
The whole question might be a corner-case, also it might be quite hard to implement. I'm asking because there are two things that annoy me to no end: annotations and warnings.Klitos Kyriacou
01/19/2024, 9:30 AMfun ruiBuilder333() {
RuiT0 { ruiExternalPatch333() }
}
fun ruiExternalPatch333() {} // <--- no args!