Rob Elliot
11/09/2025, 11:09 AMfun nullableReturn(): String? = TODO()
val timer: Timer = TODO()
try {
timer.recordCallable {
nullableReturn()
}
} finally {
timer.close()
}
> Argument type mismatch: actual type is 'CallableString?', but 'Callable<uninferred T! (of fun T : Any recordCallable)>!' was expected.Rob Elliot
11/09/2025, 11:09 AMnullableReturn returns String rather than String?.
I presume it's something to do with the signature of `Timer.recordCallable`:
T @NullUnmarked T recordCallable(CallableT f) throws Exception;
But I think micrometer is trying to say that T could be nullable there? Have they made a mistake?Rob Elliot
11/09/2025, 12:00 PMRob Elliot
11/09/2025, 12:13 PMpackage-info.java as so:
@NullMarked
package io.micrometer.core.instrument;
import org.jspecify.annotations.NullMarked;