-
Notifications
You must be signed in to change notification settings - Fork 17
Conversation
* @deprecated This function might use reflection if the factory is not provided, | ||
* better pass this object to the resource to be created instead. | ||
*/ | ||
@Deprecated @SuppressWarnings("unchecked") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an alternative solution already then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken this is used in order to cache Resources inside this class, right? If so, an alternative would be to simply use dagger to cache what needs to be cached instead of having this implicit behaviour here.
Maybe you remember better if this function had any other benefit apart from that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah, I see your point now.
Although, I believe that is an important change on how library works. Maybe a little bit more explanation about it would be better. Because I believe the original idea was to handle caching as part of library.
- If the plan to remove this functionality (which means removing the resource caching all together) maybe mention that.
- If it is only about to deprecate, and then maybe explain how would be the better approach - for documentation purposes. I assume by this change, you mean instead of getting the resource instance as
xingApi.resource(WhateverResource.class)
should be created asWhateverResource(xingApi)
and caching should be handled by developer themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also you mentioned as "it might use reflection if factory is not provided" - while I understand that can be a hidden cost, it is also a design decision, isn't it? You might wanna change that part instead of deprecating the caching mechanism then 🤷♂
How about throwing an IllegalStateException
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, we've opted for removing this completely, it will be a breaking change but we consider it important in order to prevent issues with Proguard in the future.
Also removed factories and made all resource's constructors public.
d5fcce2
to
82aa6a3
Compare
9f8c7f5
to
2c764cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change! I have a question regarding deployment and a small suggestion.
Remove old travis step
b069ce4
to
f01c735
Compare
f01c735
to
c2d4315
Compare
Deprecate XingApi's resource function as it might use reflection if no factories are declared, which causes problems with proguard unnecessarily.