0
votes

I need to inform in my class code that the function passed by parameter (convertorCall) can throw an exception.

suspend operator fun <T> invoke(
    convertorCall: () -> T
): T?

For example if this function were as a method of a class I could do this:

@Throws(JsonSyntaxException::class)
suspend fun <T> convertorCall(): T

However, as said before, I need this to be informed in the function passed by parameter of the invoke function.

I tried this:

suspend operator fun <T> invoke(
    @Throws(JsonSyntaxException::class) convertorCall: () -> T
): T?

But a syntax error is generated:

This annotation is not applicable to target 'value parameter'