Annotation type-safety
note
Annotation type safety only ensures that the resolved type parameters are annotated with the required annotation. The actual type of the passed argument may differ:
fun <@Rpc T : Any> registerService(body: () -> T) {} // T is resolved to MyService, // but 'body' returns MyServiceImpl registerService<MyService> { ctx -> MyServiceImpl(ctx) } // Error: T is resolved to MyServiceImpl registerService { ctx -> MyServiceImpl(ctx) }
warning
This feature is highly experimental and may lead to unexpected behaviour. If you encounter any issues, please report them. To prevent critical bugs from affecting your app, you can disable this feature using the following configuration:
// build.gradle.kts rpc { annotationTypeSafetyEnabled = false // true by default }