You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am trying to make a Ktorit service that would extend a base service.
Example:
// common service for all build variantsinterfaceBaseMessageService {
@GET(...)
suspendfunbaseCall(): String
}
// extended implementation for e.g. a different clientinterfaceCustomMessageService {
@GET(...)
suspendfunotherCall(): Double
}
The goal is to have a CustomService on which both baseCall and otherCall are available.
Ksp compiles but I am getting this runtime error when calling CustomMessageService.baseCall():
kotlin.UninitializedPropertyAccessException: lateinit property _converter has not been initialized
at _BaseMessageServiceImpl.get_converter
at _BaseMessageServiceImpl.baseCall
at _CustomMessageServiceImpl.baseCall
Creating CustomMessageService as usual ktorfit.create<CustomMessageService().
Describe the solution you'd like
The error makes sense - the generated CustomMessageServiceImpl extends BaseMessageService by _BaseMessageServiceImpl(). That new instance does not have the _converter because it is created by create which is not called here.
Not sure what the solution could be. I understand this usecase is not supported now? I may try to hack something.
Describe alternatives you've considered
Copy paste base service methods to all extending services.
Abandon the idea of extending and just have two separate services.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I am trying to make a Ktorit service that would extend a base service.
Example:
The goal is to have a
CustomService
on which bothbaseCall
andotherCall
are available.Ksp compiles but I am getting this runtime error when calling
CustomMessageService.baseCall()
:Creating CustomMessageService as usual
ktorfit.create<CustomMessageService()
.Describe the solution you'd like
The error makes sense - the generated
CustomMessageServiceImpl
extendsBaseMessageService by _BaseMessageServiceImpl()
. That new instance does not have the _converter because it is created bycreate
which is not called here.Not sure what the solution could be. I understand this usecase is not supported now? I may try to hack something.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: