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
It seems possible that we could generate something like RetrofitGenerated_GitHubService.class class during compilation time
Retrofit.create(final Class<T> service) would use the given interface as a key to do a lookup for the generated implementation - either something like Class.forName(...) or collecting them while they're being generated
The Retrofit instance used to create the class instance would be provided to the generated class so it has access to required Call.Factory, Converter.Factory, CallAdapter.Factory, etc to facilitate the call that currently happen within HttpServiceMethod
Move all interface validation to compile time errors
Since RetrofitGenerated_* classes would be built at compile time we would be aware of any standard declaration issues
I believe it would be possible for this to work for custom CallAdapter implementations as well if we were able to walk the methods of a given interface and check those against the provided CallAdapter.Factory list
A path towards Multiplatform support?
This isn't a leading point of this issue due to comments here Multiplatform support #3181 (comment) - to be honest I haven't kept up with Okio/OkHttp's Multiplatform capabilities to know if this is even worth pursuing here
With Moshi IR people may eventually have a meaningful choice beyond just KotinX.Serialization. I recognize that there's a ton of other work to do here as well
This really came to mind while thinking about reducing application startup time where we can certainly move our interface creation but not eliminate it
I wouldn't be envious of the maintenance for both Proxy creation and a compiler plugin. If this isn't a path worth pursuing feel free to close this issue
Figured this high level issue was worth feeling out before over-investing in a PR or some offshoot prototype
The text was updated successfully, but these errors were encountered:
Reading through Moshi IR sparked a few ideas on how a compiler plugin and/or Kotlin IR could be beneficial to Retrofit
Eliminating
Proxy.newProxyInstance(...)
Given an Retrofit compatible interface such as
It seems possible that we could generate something like
RetrofitGenerated_GitHubService.class
class during compilation timeRetrofit.create(final Class<T> service)
would use the given interface as a key to do a lookup for the generated implementation - either something likeClass.forName(...)
or collecting them while they're being generatedThe Retrofit instance used to create the class instance would be provided to the generated class so it has access to required
Call.Factory
,Converter.Factory
,CallAdapter.Factory
, etc to facilitate the call that currently happen withinHttpServiceMethod
Move all interface validation to compile time errors
Since
RetrofitGenerated_*
classes would be built at compile time we would be aware of any standard declaration issuesI believe it would be possible for this to work for custom
CallAdapter
implementations as well if we were able to walk the methods of a given interface and check those against the providedCallAdapter.Factory
listA path towards Multiplatform support?
This isn't a leading point of this issue due to comments here Multiplatform support #3181 (comment) - to be honest I haven't kept up with Okio/OkHttp's Multiplatform capabilities to know if this is even worth pursuing here
With Moshi IR people may eventually have a meaningful choice beyond just KotinX.Serialization. I recognize that there's a ton of other work to do here as well
This really came to mind while thinking about reducing application startup time where we can certainly move our interface creation but not eliminate it
I wouldn't be envious of the maintenance for both Proxy creation and a compiler plugin. If this isn't a path worth pursuing feel free to close this issue
Figured this high level issue was worth feeling out before over-investing in a PR or some offshoot prototype
The text was updated successfully, but these errors were encountered: